-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Guessing Game rand example doesn't compile #1663
Comments
Hi, your Cargo.toml also needs to have When I build this code with I see that the Cargo.toml shown at the beginning of Chapter 2 doesn't have the edition metadata, so perhaps that caused you to remove it? That's the only bug I can see here; I'm going to fix that. Please let me know if anything else regarding the edition key was confusing. |
BTW thank you for providing a repo, that made it very easy to check what the problem was! |
😊 the "thanks for providing a repo" thing was very validating and nice, thanks! also thanks for taking care of this issue, <3 ! |
I found a related inconsistency. Right below the example code that @zvory quoted (listing 2-3), the first paragraph says:
It appears that this is referring to a As a sidenote, it would make sense to add a note in section 1.1 that explains that the book is assuming that the reader is using 1.31.0 or later. In my case, I did not use the Thanks for your work on the book! |
Yep! That has been fixed in master, but we haven't pulled the fix into rust-lang/rust to update doc.rust-lang.org/book yet. It'll be there soon!
Yup! We plan to add that; we're just deciding exactly where it should go in both online and print. It's tracked as an item in the "Smaller changes" section of this issue.
You're welcome, thank you for your comments! ❤️ |
Hi @carols10cents -- just wanted to bump this, as I came here to open an issue for the |
There's nothing to do; it will make its way to stable like everything else. It can take up to 12 weeks, and since I think we may have missed one update, 18 weeks, for things to percolate up. That's just the way things work, unfortunately. |
Thanks, @steveklabnik, for the explanation.
I can think of legitimate reasons that it works this way (I'm new here, btw), but if it's "unfortunate" that it works this way, is it worth reconsidering? Perhaps this isn't the change to die on a hill for, though... |
Well, there's pros and cons, like everything else. The pros far outweigh the cons. This might make for a good thread on users.rust-lang.org though! |
Hi there,
It showed the following message:
The "^" near "expected" (at the message) points out to opening curly bracket close to "parse()". Compiling it with the last version of Rust compiler. |
You're missing a |
:O Sorry for the inconveniences. Best regards..and thanks, @steveklabnik |
For those who where already stuck with this problem even after adding About the book, what to do think about adding a line to explain that edit : I just went to see that the first page of the book states : |
I still have the same problem in Feb 2020, running 1.41.0. Going through the tutorial I needed to google and find this. Adding
fixed the issue, but it would be nice to have the tutorial work, it's been over a year. edit: same deal for the next example, requires |
@russellyoung do you have |
@carols10cents Thanks for checking in on this. Yes, the version I have (1.41.0) included that in Cargo.toml, and I confirmed that it was there before posting. |
@russellyoung I am able to build the code in this directory with Rust 1.41.0, and it doesn't have the Can you post the exact error you got before adding those lines, and the complete code you ran with that error? I would like to fix this problem, but I don't understand the problem completely yet. |
@carols10cents Sure, here it is. toml:
code:
With the use statement included it runs correctly. With it commented out as in the included code it gets the following error:
As a rust rookie I would guess the |
@russellyoung you do need a |
oh my goodness is my face red, I guess I was going through too fast and just missed those "unimportant" lines. Sorry to have taken your time. And I'm sorry my postings have an identifiable name :-| |
It happens. Thank you for the apology, take care! |
Versions
Book:
rustc:
rustc 1.31.0 (abe02cefd 2018-12-04)
cargo:
cargo 1.31.0 (339d9f9c8 2018-11-16)
What is the issue:
When going through the Guessing Game tutorial:
Listing 2-3 contains some code that should use
rand
:This code does not compile, with the following errors:
This is of course after adding the following to my
Cargo.toml
:Here's a github repo with my repo when it is breaking: https://github.com/zvory/guessing-game-breaking
The text was updated successfully, but these errors were encountered: