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
Support for 2018 edition #105
Comments
Thanks for the report. enum RustEdition {
Rust2015,
Rust2018
} |
I agree. Is there an easy way to write a test to test this? |
I found passing another argument ( Proof of concept: FallingSnow@2b0fcfe |
Nightly (8-23-2018) also seems to have an issue with the generated All tests pass and I'm willing to submit a pull request if you would like. |
Cool! I think before getting this landed it would be good to avoid the unsafe static mutable variable. Probably there should be a new field of type For testing, I think it would make sense to update one of the examples to use 2018 edition. |
I agree.
As far as I'm aware you have to define the rust version as the crate level. Is it possible to use 2018 in a single example? |
All of the capnp examples are in their own crates because they require code generation. I think the |
I got it mostly setup. Rust edition is now passed to the generator context. FallingSnow@96b8c13 I just don't know where to add capnproto-rust/capnpc/src/codegen.rs Lines 53 to 68 in 3502749
crate:: to every path, not just the generated code paths.
|
Does this work?
|
Yes. I flip flopped the output of 2015 and 2018 and it appears to be working. Fork I've just been running |
Yep. You could also try running the example with I predict that |
$ cargo +stable build --all --exclude addressbook_send
error: failed to parse manifest at `/home/ayrton/Documents/capnproto-rust/example/addressbook_send/Cargo.toml`
Caused by:
the cargo feature `edition` requires a nightly version of Cargo, but this is the `stable` channel Hmm. Removing |
I'd be okay with not checking in anything that tests the new edition until it's actually on a stable rustc release. |
We'll do that then. |
Any update on wrapping this into a PR and getting it merged? The fork seems to be working well for me! |
Resolved in 322becc |
:D |
Nice, thanks! |
Perhaps it would be good to push a new version to cargo? |
@Restioson Support for Rust 2018 was included in the 0.9.1 version of the capnpc crate, published 12 November 2018. |
With more recent versions of rustc, we can generate code that works for both editions. I've pushed a change to take advantage of that: 6f09e5f |
Currently
capnpc
generates incompatible code with rust 2018.Seems to be an issue with using
::
to refer to the crate root. This has been changed tocrate::
in 2018.2015 Edition:
2018 Edition:
The text was updated successfully, but these errors were encountered: