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

Getting started is horribly, horribly out of date #423

Closed
stephen-standridge opened this Issue Sep 1, 2016 · 8 comments

Comments

Projects
None yet
5 participants
@stephen-standridge

stephen-standridge commented Sep 1, 2016

Hello!
I've attempted to use diesel because I really like the interface, however I've been in getting started hell for a while now.

I ran into several issues around the diesel_codegen version, which I've fixed with a lot of time spent in this repository's issues section. Now I'm attempting to get diesel to compile for stable and am running into all sorts of version mismatches with syntex and am starting to wondering if this project actually works for anyone.

build.rs:13   diesel_codegen_syntex::register(&mut registry);
                                              ^~~~~~~~~~~~~
build.rs:13:35: 13:48 help: run `rustc --explain E0308` to see a detailed explanation
build.rs:13:35: 13:48 note: expected type `&mut syntex::Registry`
build.rs:13:35: 13:48 note:    found type `&mut syntex::Registry`
build.rs:13:35: 13:48 note: Perhaps two different versions of crate `syntex` are being used?
build.rs:13   diesel_codegen_syntex::register(&mut registry);
                                              ^~~~~~~~~~~~~
build.rs:14:28: 14:41 error: mismatched types [E0308]
build.rs:14   dotenv_codegen::register(&mut registry);
                                       ^~~~~~~~~~~~~
build.rs:14:28: 14:41 help: run `rustc --explain E0308` to see a detailed explanation
build.rs:14:28: 14:41 note: expected type `&mut syntex::Registry`
build.rs:14:28: 14:41 note:    found type `&mut syntex::Registry`
build.rs:14:28: 14:41 note: Perhaps two different versions of crate `syntex` are being used?
build.rs:14   dotenv_codegen::register(&mut registry);
                                       ^~~~~~~~~~~~~
error: aborting due to 2 previous errors

This is after having moved my extern definitions outside of the main body, after trying the syntex version specified in getting_started 0.31, as well as internet-suggested versions like 0.38, and 0.42. I'm running out of things the internet says to try.

The barrier of entry to using this is real, the main issue here is that the getting_started isn't up to date. I would totally put a pull request up against it if only I could get it to work.

Thanks for all the hard work you've put into this, it was fun trying to use it!

@killercup

This comment has been minimized.

Member

killercup commented Sep 1, 2016

Hi, thanks for reaching out and writing an issue instead of just giving up and moving on! (Something I'm sure guilty of…)

So, with 0.7, the codegen story change a bit, which is why the getting started guide is probably out of date. This is being worked on! In PR #404 you can see we are about to add the example code from that guide to this repository.

As the changelog entry for 0.7 (here) mentions, "diesel_codegen has been split into two crates." @sgrif wrote a bit in this commit message on how to migrate.

Your error—thanks for adding this—already mentions what the problem is: There are two different versions of syntex in use. I admit, that's a bit hard to read 😄 I was actually looking at the Travis logs for #404 when I noticed that.

You are using diesel_codegen_syntax in version 0.7.2, right? That version has an upper bound on syntex version 0.43 (you mentioned 0.42 above). So, try to use 0.43? Can you check in your Cargo.lock what syntex you are using? If there are multiple versions, try to make sure to reduce it to one.

I hope that helps—this is just me guessing, actually…

@sgrif

This comment has been minimized.

Member

sgrif commented Sep 1, 2016

Sorry, I've been short on time. I will make sure the guides are up to date this weekend.

@stephen-standridge

This comment has been minimized.

stephen-standridge commented Sep 2, 2016

That did it @killercup, thank you! This is my first rust project, so I'm still learning many of the debugging skills. Now I know version management is an active process with cargo.

@sgrif Thank you!

I'm really glad this project exists and that you all are so responsive with it!

@devinrsmith

This comment has been minimized.

devinrsmith commented Sep 5, 2016

I'm just getting started and have been having a bad time. I've been following the current guide http://diesel.rs/guides/getting-started/ using the specific rust nightly. This issue is specifically labeled as "out of date", but I was under the impression that given rust's semantic versioning, old rust examples should just work.

But it won't even start compiling.

$ cargo build
    Updating registry `https://github.com/rust-lang/crates.io-index`
error: Package `diesel_codegen v0.7.0` does not have these features: `nightly`

Removing the nightly feature from the toml gets a bit further, but quickly runs into compile errors:

/Users/dsmith/.cargo/registry/src/github.com-1ecc6299db9ec823/dotenv_codegen-0.8.1/src/dotenv_macro.rs:13:66: 13:80 error: type name `ast::TokenTree` is undefined or not in scope [E0412]
/Users/dsmith/.cargo/registry/src/github.com-1ecc6299db9ec823/dotenv_codegen-0.8.1/src/dotenv_macro.rs:13 pub fn expand_dotenv<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
                                                                                                                                                                           ^~~~~~~~~~~~~~
/Users/dsmith/.cargo/registry/src/github.com-1ecc6299db9ec823/dotenv_codegen-0.8.1/src/dotenv_macro.rs:13:66: 13:80 help: run `rustc --explain E0412` to see a detailed explanation
/Users/dsmith/.cargo/registry/src/github.com-1ecc6299db9ec823/dotenv_codegen-0.8.1/src/dotenv_macro.rs:13:66: 13:80 help: you can import it into scope: `use syntax::tokenstream::TokenTree;`.
/Users/dsmith/.cargo/registry/src/github.com-1ecc6299db9ec823/dotenv_codegen-0.8.1/src/dotenv_macro.rs:25:50: 25:64 error: type name `ast::TokenTree` is undefined or not in scope [E0412]
/Users/dsmith/.cargo/registry/src/github.com-1ecc6299db9ec823/dotenv_codegen-0.8.1/src/dotenv_macro.rs:25 fn expand_env(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
                                                                                                                                                           ^~~~~~~~~~~~~~
/Users/dsmith/.cargo/registry/src/github.com-1ecc6299db9ec823/dotenv_codegen-0.8.1/src/dotenv_macro.rs:25:50: 25:64 help: run `rustc --explain E0412` to see a detailed explanation
/Users/dsmith/.cargo/registry/src/github.com-1ecc6299db9ec823/dotenv_codegen-0.8.1/src/dotenv_macro.rs:25:50: 25:64 help: you can import it into scope: `use syntax::tokenstream::TokenTree;`.
error: aborting due to 2 previous errors

I'm new to rust, so I'm not sure where to turn to next. I'm not sure where the issue lies. Is this an issues with diesel? Is this an issue with a dependency? Is the guide in error? Did somebody break the semantic versioning rules such that the example no longer works now? If so, can the example be updated with very specific versions to get things running? Am I using the wrong nightly?

When a large public project such as diesel doesn't compile, especially given a "getting started" guide, it reflects poorly on rust IMO. Hoping this can be resolved quickly!

@Emilgardis

This comment has been minimized.

Emilgardis commented Sep 6, 2016

@devinrsmith
A breaking change to ast caused this (see slapresta/rust-dotenv#44).
However, another error pops up after that will in some time hopefully be fixed with #426, but meanwhile to use all of this replace your dependencies section with

[dependencies]
diesel = { git = "https://github.com/SergioBenitez/diesel" }
diesel_codegen = { git = "https://github.com/SergioBenitez/diesel", default-features = false, features = ["postgres"] }
dotenv = {git = "https://github.com/slapresta/rust-dotenv" }
dotenv_macros = {git = "https://github.com/slapresta/rust-dotenv" }

This solution is not pretty, but it works. These problems come from that diesel only "supports" new nightly releases with steps of 6 weeks.

I've also just started using diesel, and this was a huge 👎 for me. But the problem is really on our part, nightly is not stable after all. (Protip: If you want to skip all the mess, with rustup run rustup default nightly-2016-08-18, or if you don't have rustup, install it.)

As a sidenote, the getting started guide is probably one of the best I've seen, I even learnt something new about how cargo treats --bin.

@sgrif

This comment has been minimized.

Member

sgrif commented Sep 6, 2016

@Emilgardis I know you disagree with our nightly support policy but please don't start commenting on every issue complaining about it.

@Emilgardis

This comment has been minimized.

Emilgardis commented Sep 6, 2016

This was my first comment on diesel (?). And I can understand the decision you've made, it makes sense.

Edit:: To add some value to this comment, what do you think of the idea @killercup had?

@sgrif

This comment has been minimized.

Member

sgrif commented Sep 6, 2016

My bad I thought you were someone who had opened another issue. 👍

killercup added a commit to killercup/diesel.rs-website that referenced this issue Sep 9, 2016

Update ALL the versions for with-syntex
syntax is now at 0.42. There is an 0.43 already, though.

Hopefully fixes diesel-rs/diesel#423

killercup added a commit to killercup/diesel.rs-website that referenced this issue Sep 9, 2016

killercup added a commit to killercup/diesel.rs-website that referenced this issue Sep 9, 2016

Update ALL the versions for with-syntex
syntax is now at 0.42. There is an 0.43 already, though.

Hopefully fixes diesel-rs/diesel#423

killercup added a commit to killercup/diesel.rs-website that referenced this issue Sep 9, 2016

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