-
Notifications
You must be signed in to change notification settings - Fork 292
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
Modify Cargo.toml example to contain edition #711
Conversation
I think that'll do the trick. I think they may have forgotten to include it in the docs after this commit: |
Hi @alanwsmith, thanks a lot for reporting. I can confirm what @Velocity- says, which sounds both reasonable and indeed fixes the issue in practice, without needing an additional non build-deps toward LALRPOP. If you're willing to implement this change on this PR (or open a new one), I'm willing to review and merge ! |
hmm, I wonder if lexer should be a default feature -- separate question though |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks ok to me. The lexer
feature of LALRPOP just enables the same feature in lalrpop-util
, so moving the feature to lalrpop-util
should do exactly the same, while being more accurate IMHO (in the end, the crate exposing the feature is lalrpop-util
)
I'm afraid I don't know my way around pull requests very well. It sounds like maybe it already got fixed and I can just close this? |
Co-Authored-By: Niko Matsakis <niko@alum.mit.edu>
Nothing much is left for this PR, as the lexer feature has been added in separate PRs. There is still the README fixup though, that could be useful to merge. I've rebased it. @youknowone could you give a quick look? |
Update how lalropop is declared in Cargo.toml to work around lalrpop/lalrpop#711
TL;DR
When I run
cargo init
it produces aCargo.toml
file withedition = "2021"
in it.When I went through Adding LALRPOP to your Cargo.toml file in the tutorial I only updated the
[build-dependencies]
and[dependencies]
sections not thinking about theedition
in the[package]
section at all.I got a bunch of errors shown below.
Three options that fixed the errors for me were:
1: Changing the edition to "2018" in
Cargo.toml
2: Removing the edition from
Cargo.toml
3: Keeping the edition at "2021" and adding
lalrpop = "0.19.8"
to the[dependencies]
in the
Cargo.toml
fileI'm still new to Rust, but I don't think I've customized
cargo init
in a way that makes it add the edition. I'm assuming it does that by default now. With that in mind I'm put together this PR which adds the edition to the example and putslalrpop
under the dependencies.Steps to reproduce:
Step 1
Run:
and
cd
into the directory withcd calculator
Step 2
Update the
build-dependencies
anddependencies
sections of the
Cargo.toml
file by modifying thisdefault file that was created:
To:
Step 3
Create
build.rs
withStep 4
Create
src/calculator1.lalrpop
with:Step 5
Change the main.rs file to:
Step 6
Run:
And see a bunch of errors like:
Fix
The option I chose to get the test to run is to change the
Cargo.toml
to addlalrpop
to[dependencies]
so the file changes from this:To this:
As far as I can tell that's what needs to happen, but if there's a something better to do I'd be happy to hear about it.