Skip to content
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

Merged
merged 1 commit into from
Jan 14, 2019
Merged

Rust 2018 Edition #1519

merged 1 commit into from
Jan 14, 2019

Conversation

hayd
Copy link
Contributor

@hayd hayd commented Jan 14, 2019

This PR updates deno to using the 2018 edition and its idioms.

It runs cargo fix --edition and cargo fix --edition-idioms (with some hand-tweaks).

Reboot of #1306.

Note: This makes the minimum version of rust to compile deno 1.31.

metadata.level() <= log::max_level()
}

fn log(&self, record: &log::Record) {
fn log(&self, record: &log::Record<'_>) {
Copy link
Member

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?

Copy link
Contributor Author

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...

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -62,6 +63,9 @@ template("rust_crate") {
if (!defined(crate_name)) {
crate_name = target_name
}
if (!defined(edition)) {
edition = "2015"
Copy link
Member

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.

Copy link
Member

@piscisaureus piscisaureus left a 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.

@piscisaureus piscisaureus merged commit 526fdac into denoland:master Jan 14, 2019
@hayd hayd deleted the rust-2018-2 branch January 14, 2019 23:03
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