Skip to content

Switch from try!() to ? in generated code to make it work in Rust 2018 - #109

Merged
dwrensha merged 1 commit into
capnproto:masterfrom
bmisiak:patch-1
Oct 6, 2018
Merged

dwrensha merged 1 commit into
capnproto:masterfrom
bmisiak:patch-1

Conversation

@bmisiak

@bmisiak bmisiak commented Oct 6, 2018

Copy link
Copy Markdown
Contributor

Rust 2018 removes the try!() macro and makes try a reserved keyword in accordance with RFC 2388. On the other hand, the ? operator was introduced way back in Rust 1.13 and is now stable.

Without the change, rustc will refuse to compile the generated code starting with the 2018 edition:

expected expression, found reserved keyword `try`

While this project itself is free to use try!() and not switch to Rust 2018, its output files - preferably - should be compatible with both editions.

rust-lang/rust#31436

Rust 2018 removes the `try!()` macro and makes `try` a reserved keyword in accordance with RFC 2388: rust-lang/rfcs#2388. On the other hand, the `?` operator was introduced way back in Rust 1.13 and is now stable.

Without the change, rustc will refuse to compile the generated code starting with the 2018 edition. While this project itself is free to use `try!()` and not switch to Rust 2018, its output files - preferably - should be compatible with both editions.

rust-lang/rust#31436
@dwrensha
dwrensha merged commit 395cb66 into capnproto:master Oct 6, 2018
@dwrensha

dwrensha commented Oct 6, 2018

Copy link
Copy Markdown
Member

Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants