-
Notifications
You must be signed in to change notification settings - Fork 5.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
Rust 2018 Edition #1519
Rust 2018 Edition #1519
Conversation
metadata.level() <= log::max_level() | ||
} | ||
|
||
fn log(&self, record: &log::Record) { | ||
fn log(&self, record: &log::Record<'_>) { |
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.
I read rust2018 would allow for more elided lifetimes... Why do we need to put <'_> everywhere all of a sudden?
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.
Good question, I'd thought they look a little weird. I'll try and remove them and see if everything compiles.
It could be a bug with cargo fix
...
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.
Looks like these are not required, I will remove them.
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.
Actually I am not sure about this, so holding back my commit.
Perhaps someone else else can chime in.
The behavior around dyn Trait is probably worth highlighting, since it is one case where '_ differs from writing nothing at all.
From this issue: rust-lang/rust#48469
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.
Okay, it looks like it is explained here: https://rust-lang-nursery.github.io/edition-guide/rust-2018/ownership-and-lifetimes/the-anonymous-lifetime.html
build_extra/rust/rust.gni
Outdated
@@ -62,6 +63,9 @@ template("rust_crate") { | |||
if (!defined(crate_name)) { | |||
crate_name = target_name | |||
} | |||
if (!defined(edition)) { | |||
edition = "2015" |
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.
Presumably most crates will eventually be ported to 2018, so I don't think that we should default to edition 2015 -- and in general I think we do without passing --edition at all.
Don't do anything yet tho -- I'm going to apply your patch and re-run the BUILD.gn generator and see what happens.
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.
I'll land this after making 2018 the default for everything.
ddf066c
to
526fdac
Compare
This PR updates deno to using the 2018 edition and its idioms.
It runs
cargo fix --edition
andcargo fix --edition-idioms
(with some hand-tweaks).Reboot of #1306.
Note: This makes the minimum version of rust to compile deno 1.31.