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

Queryable, Insertable derivations not compiling on 1.14.0-nightly #492

Closed
stearnsc opened this Issue Nov 11, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@stearnsc

stearnsc commented Nov 11, 2016

I'm not super plugged in to the ecosystem developments, so sorry if I missed something obvious.

I just updated to 1.14.0-nightly, and my diesel code stopped compiling. I went back to the guide to create the simplest failure I could, which is here:

lib.rs:

#![feature(proc_macro)]

#[macro_use] extern crate diesel_codegen;
#[macro_use] extern crate diesel;

use diesel::prelude::*;

pub mod models {
	use super::schema::posts;

	#[derive(Debug, Queryable)]
	pub struct Post {
		pub id: i32,
		pub title: String,
		pub body: String,
		pub published: bool,
	}

	#[derive(Debug, Insertable)]
	#[table_name = "posts"]
	pub struct NewPost {
		pub title: String,
		pub body: String,
		pub published: bool,
	}
}

pub mod schema {
	table! {
		posts {
			id -> Integer,
			title -> Text,
			body -> Text,
			published -> Bool,
		}
	}
}

Cargo.toml:

[package]
name = "diesel_test"
version = "0.1.0"

[dependencies]
diesel = "*"
diesel_codegen = { version = "*", features = ["postgres"] }

output:

$ cargo build
   Compiling diesel_test v0.1.0 (file:///Users/cstearns/workspace/diesel_test)
error: `#[derive]` for custom traits is not stable enough for use. It is deprecated and will be removed in v1.15 (see issue #29644)
  --> src/lib.rs:11:18
   |
11 | 	#[derive(Debug, Queryable)]
   | 	                ^^^^^^^^^
   |
   = help: add #![feature(custom_derive)] to the crate attributes to enable

error: `#[derive]` for custom traits is not stable enough for use. It is deprecated and will be removed in v1.15 (see issue #29644)
  --> src/lib.rs:19:18
   |
19 | 	#[derive(Debug, Insertable)]
   | 	                ^^^^^^^^^^
   |
   = help: add #![feature(custom_derive)] to the crate attributes to enable

error: aborting due to 2 previous errors

error: Could not compile `diesel_test`.

To learn more, run the command again with --verbose.

It's suggesting adding custom_derive, but that feels like the wrong fix, given that it's about to go away entirely. Any ideas?

@sgrif

This comment has been minimized.

Member

sgrif commented Nov 12, 2016

Swap the order of extern crate diesel; and extern crate diesel_codegen. I've opened #495 which has the root cause to discuss what we can do to make this workaround unnecessary.

@sgrif sgrif closed this Nov 12, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment