Beginning w/ diesel 1.3 (seen on rust 1.26.0 stable), the embed_migrations! macro produces a rustc warning:
warning: unused import: `EmbedMigrations`
--> autopush_rs/src/lib.rs:136:1
|
136 | embed_migrations!();
| ^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(unused_imports)] on by default
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
(A couple others on the gitter have also reported seeing it)
Can you provide a minimal crate to reproduce the issue? Can you also provide the output of building with -Z external-macro-backtrace
on a nightly compiler?
Minimal crate: https://github.com/pjenvey/diesel1739
Not sure the external-macro-backtrace is too helpful here:
warning: unused import: `EmbedMigrations`
--> <embed_migrations macros>:3:14
|
1 | / ( ) => {
2 | | # [ allow ( dead_code ) ] mod embedded_migrations {
3 | | # [ derive ( EmbedMigrations ) ] struct _Dummy ; } } ; (
| | ^^^^^^^^^^^^^^^
4 | | $ migrations_path : expr ) => {
... |
7 | | embed_migrations_options ( migrations_path = $ migrations_path ) ] struct
8 | | _Dummy ; } }
| |____________- in this expansion of `embed_migrations!`
|
::: src/main.rs:10:1
|
10 | embed_migrations!();
| -------------------- in this macro invocation
|
= note: #[warn(unused_imports)] on by default
Finished dev [unoptimized + debuginfo] target(s) in 47.02s
cargo expand:
#![feature(prelude_import)]
#![no_std]
#[prelude_import]
use std::prelude::v1::*;
extern crate diesel;
#[macro_use]
extern crate diesel_migrations;
#[macro_use]
extern crate std;
fn main() {
::io::_print(::std::fmt::Arguments::new_v1(
&["Hello, world!\n"],
&match () {
() => [],
},
));
}
#[allow(dead_code)]
mod embedded_migrations {
struct _Dummy;
extern crate diesel;
extern crate diesel_migrations;
use self::diesel_migrations::*;
use self::diesel::migration::*;
use self::diesel::connection::SimpleConnection;
use std::io;
const ALL_MIGRATIONS: &[&Migration] =
&[&EmbeddedMigration{version: "20180220220249",
up_sql:
"CREATE TABLE broadcastsv1 (\n broadcaster_id VARCHAR(64) NOT NULL,\n bchannel_id VARCHAR(128) NOT NULL,\n created TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,\n last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL,\n version VARCHAR(200) NOT NULL,\n PRIMARY KEY(broadcaster_id, bchannel_id)\n);\n",}];
struct EmbeddedMigration {
version: &'static str,
up_sql: &'static str,
}
impl Migration for EmbeddedMigration {
fn version(&self) -> &str {
self.version
}
fn run(&self, conn: &SimpleConnection) -> Result<(), RunMigrationsError> {
conn.batch_execute(self.up_sql).map_err(Into::into)
}
fn revert(&self, _conn: &SimpleConnection) -> Result<(), RunMigrationsError> {
{
{
::rt::begin_panic(
"internal error: entered unreachable code",
&("src/main.rs", 10u32, 1u32),
)
}
}
}
}
pub fn run<C: MigrationConnection>(conn: &C) -> Result<(), RunMigrationsError> {
run_with_output(conn, &mut io::sink())
}
pub fn run_with_output<C: MigrationConnection>(
conn: &C,
out: &mut io::Write,
) -> Result<(), RunMigrationsError> {
run_migrations(conn, ALL_MIGRATIONS.iter().map(|v| *v), out)
}
Can we cut a release of diesel_migrations so that this change is in a released version?
Most helpful comment
Can we cut a release of diesel_migrations so that this change is in a released version?