-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
embed_migrations! warning: unused import: EmbedMigrations
#1739
Comments
Can you provide a minimal crate to reproduce the issue? Can you also provide the output of building with |
pjenvey
added a commit
to pjenvey/diesel1739
that referenced
this issue
May 31, 2018
Minimal crate: https://github.com/pjenvey/diesel1739 Not sure the external-macro-backtrace is too helpful here:
|
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)
} |
sgrif
added a commit
that referenced
this issue
Jun 1, 2018
The changes for barrel support led to `diesel_migrations` exporting everything required by this macro, leading to the warning being generated. Fixes #1739
Can we cut a release of diesel_migrations so that this change is in a released version? |
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Beginning w/ diesel 1.3 (seen on rust 1.26.0 stable), the embed_migrations! macro produces a rustc warning:
(A couple others on the gitter have also reported seeing it)
The text was updated successfully, but these errors were encountered: