Skip to content

Edition 2021 blog post#825

Merged
Mark-Simulacrum merged 6 commits into
rust-lang:masterfrom
m-ou-se:plan-2021
May 11, 2021
Merged

Edition 2021 blog post#825
Mark-Simulacrum merged 6 commits into
rust-lang:masterfrom
m-ou-se:plan-2021

Conversation

@m-ou-se

@m-ou-se m-ou-se commented Apr 28, 2021

Copy link
Copy Markdown
Member

cc @rust-lang/project-edition-2021

Rendered

Closes rust-lang/rust#84593

@m-ou-se
m-ou-se requested a review from a team April 28, 2021 10:16
Comment thread posts/2021-04-30-edition-2021.md Outdated
@ChrisDenton

Copy link
Copy Markdown
Member

In the panic section, should panic_any be briefly mentioned as an alternative for rarer use cases?

@m-ou-se

m-ou-se commented Apr 28, 2021

Copy link
Copy Markdown
Member Author

In the panic section, should panic_any be briefly mentioned as an alternative for rarer use cases?

I don't think so. This is not the edition guide; just an overview. I only very quickly mention the existence of non-string panics, which are rather uncommon.

Edit: Added a small note now.

@therealprof

Copy link
Copy Markdown
Contributor

Hm, I'm seeing a contradiction in the text:

for e in [1, 2, 3] {} // Error :(

and later it says:

It does not affect any other syntax such as for e in [1, 2, 3] or iter.zip([1, 2, 3]). Those will start to work in all editions.

Did you mean to say for e in &[1, 2, 3]?

Also I find it strange that for &e in &[1, 2, 3] {} // Ok :) is mentioned since I don't see that &esyntax too often and it might throw off some readers...

@m-ou-se

m-ou-se commented Apr 28, 2021

Copy link
Copy Markdown
Member Author

@therealprof That snippet describes the current situation, before Rust 1.53.

Until Rust 1.53, [..]

Starting in 1.53, we will have that trait implementation and for e in [1, 2, 3] {} will start to work in all editions.

[..] Those will start to work in all editions.

@therealprof

Copy link
Copy Markdown
Contributor

@m-ou-se Thanks for pointing out how bad of a reader I am. 😅 After a few more passes I can parse that correctly, so 👍 from me. I'd still change

for &e in &[1, 2, 3] {}

to

for e in &[1, 2, 3] {}

so the important difference stands out a bit clearer.

@m-ou-se

m-ou-se commented Apr 28, 2021

Copy link
Copy Markdown
Member Author

I purposely put that & there, to make it clear that iterating over &[1, 2, 3] results in &i32, not i32. Otherwise the difference might just seem like you can now write in [..] instead of in &[..] with no semantic difference.

@m-ou-se
m-ou-se force-pushed the plan-2021 branch 2 times, most recently from ddf701b to 824cb36 Compare April 28, 2021 13:56
@therealprof

Copy link
Copy Markdown
Contributor

I purposely put that & there, to make it clear that iterating over &[1, 2, 3] results in &i32, not i32. Otherwise the difference might just seem like you can now write in [..] instead of in &[..] with no semantic difference.

Fair enough, what about ref e then to make it more expressive?

@m-ou-se

m-ou-se commented Apr 28, 2021

Copy link
Copy Markdown
Member Author

Fair enough, what about ref e then to make it more expressive?

That does the opposite. That will add a reference, giving you &&i32:

    for ref e in &[1, 2, 3] {
        let _: i32 = **e;
    }

@therealprof

Copy link
Copy Markdown
Contributor

I guess I really need to shut up and hide in a dark place now to read up on the syntax quirks and automatic derefencing. 😅 Thanks for the education.

@Mark-Simulacrum Mark-Simulacrum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think pushing this out to May 10th or 11th would be good. By then I hope that we can have the primary edition RFC merged and the changes still in-flight (e.g., T-libs approval of prelude, token reservation RFC merged) also finished up.

Comment thread posts/2021-04-30-edition-2021.md Outdated
Comment thread posts/2021-04-30-edition-2021.md Outdated
Comment thread posts/2021-04-30-edition-2021.md Outdated
Comment thread posts/2021-04-30-edition-2021.md
@m-ou-se
m-ou-se force-pushed the plan-2021 branch 2 times, most recently from 3b31e80 to 2d07263 Compare April 28, 2021 17:53
Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
Comment thread posts/2021-04-30-edition-2021.md
@steffahn

steffahn commented May 2, 2021

Copy link
Copy Markdown
Member

When reading rust-lang/rust#84147, I found it noteworthy that in particular IntoIterator::into_iter([1, 2, 3]) will work in Rust 2018/2015, too. Maybe that could be mentioned as another example around

syntax such as for e in [1, 2, 3] or iter.zip([1, 2, 3]). Those will start to work in all editions.

Comment thread posts/2021-04-30-edition-2021.md Outdated
@m-ou-se

m-ou-se commented May 3, 2021

Copy link
Copy Markdown
Member Author

@bstrie, @steffahn, @digama0: Thanks for the feedback.

@m-ou-se

m-ou-se commented May 3, 2021

Copy link
Copy Markdown
Member Author

I think pushing this out to May 10th or 11th would be good. By then I hope that we can have the primary edition RFC merged and the changes still in-flight (e.g., T-libs approval of prelude, token reservation RFC merged) also finished up.

Sounds good. @rust-lang/core can y'all review it this week so we can publish it next Monday?

@m-ou-se

m-ou-se commented May 10, 2021

Copy link
Copy Markdown
Member Author

@Mark-Simulacrum Can we get this merged and published today? :)

@Mark-Simulacrum

Copy link
Copy Markdown
Member

I think let's go for tomorrow: it seems likely this wants good coverage, but today we're merging #836 and that'll likely distract from this.

@m-ou-se

m-ou-se commented May 11, 2021

Copy link
Copy Markdown
Member Author

tomorrow

$ date +%F
2021-05-11

:D

@Mark-Simulacrum
Mark-Simulacrum merged commit e689ed2 into rust-lang:master May 11, 2021
@m-ou-se
m-ou-se deleted the plan-2021 branch May 11, 2021 15:10
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.

Blog post announcing Rust 2021 feature set

8 participants