I'm trying to build diesel_demo with a stable compiler, not a nightly. Part of the build.rs
, modified by me, is:
fn main() {
extern crate syntex;
extern crate diesel_codegen_syntex;
extern crate dotenv_codegen;
use std::env;
use std::path::Path;
let out_dir = env::var_os("OUT_DIR").unwrap();
let mut registry = syntex::Registry::new();
diesel_codegen_syntex::register(&mut registry);
dotenv_codegen::register(&mut registry);
let src = Path::new("src/lib.in.rs");
let dst = Path::new(&out_dir).join("lib.rs");
registry.expand("", &src, &dst).unwrap();
}
When building with Rust 1.11, I get an error:
error: mismatched types [E0308]
diesel_codegen_syntex::register(&mut registry);
^~~~~~~~~~~~~
help: run `rustc --explain E0308` to see a detailed explanation
note: expected type `&mut syntex::Registry`
note: found type `&mut main::syntex::Registry`
error: mismatched types [E0308]
dotenv_codegen::register(&mut registry);
^~~~~~~~~~~~~
help: run `rustc --explain E0308` to see a detailed explanation
note: expected type `&mut syntex::Registry`
note: found type `&mut main::syntex::Registry`
What is the main::syntex::Registry
type, where did the compiler get it and why it is not the same thing as syntex::Registry
?
To reproduce this issue you need change Cargo.toml
of disel_demo
:
-default = ["nightly"]
+default = ["with-syntex"]
and replace diesel_codegen
with diesel_codegen_syntex
in build.rs
It looks like there are two syntex::Registry
types. I have no idea why, but because diesel_codegen_syntex
depends on syntex
, there may be two different versions of syntex
?
extern crate
inside the function, because of I didn't meet such construction before.syntex
in theCargo.lock
file?syntex_something