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

Migrate all rust-lang code to edition 2021 #98992

Closed
est31 opened this issue Jul 6, 2022 · 3 comments
Closed

Migrate all rust-lang code to edition 2021 #98992

est31 opened this issue Jul 6, 2022 · 3 comments
Labels
A-edition-2021 Area: The 2021 edition C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC

Comments

@est31
Copy link
Member

est31 commented Jul 6, 2022

8 months after the 2021 edition release, there are still many mentions of the 2018 edition on the official rust-lang organization according to this search.
I wonder if it might be a good idea to migrate them to the new edition or to keep them as is. Some probably can't be migrated due to MSRV concerns, but many others it is probably okay to migrate them and provide the best contribution experience.

cc #88637 and #88638 and which tracked this for the compiler and libraries in this repo.

cc @m-ou-se

@rustbot label A-edition-2021

@rustbot rustbot added the A-edition-2021 Area: The 2021 edition label Jul 6, 2022
@fmease fmease added the C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC label Feb 12, 2025
@fmease
Copy link
Member

fmease commented Feb 12, 2025

Using the updated form of the link from the issue description — https://grep.app/search?f.repo.pattern=rust-lang%2F&q=edition+%3D+%222018%22 — 99% of the results (I didn't look at all ~280, only at the first ~80?) are simply tests from rustc, cargo, etc. which is obviously perfectly fine; the other 1% stem from historical documents (changelogs, blog posts).

Closing as completed. Feel free to reopen if I missed something.

@fmease fmease closed this as completed Feb 12, 2025
@est31
Copy link
Member Author

est31 commented Feb 13, 2025

Tests are also code that is being maintained. Unless the test is specific to a particular edition, we can also use the latest one.

@fmease
Copy link
Member

fmease commented Feb 13, 2025

Hmm, I'm not convinced by that.

It would be an incredible amount of churn to update the entirety of tests/ with each new edition.

I don't know how many thousands that would be, I haven't checked. It would not only be churn but also cost actual work since people would need to manually determine if a given test is edition sensitive or rather pertains to a specific edition or if Rust 2018 or 2021 was simply chosen to avoid having to add extern crate. Sure, technically one could upgrade the edition of tests exercising – let's say – the 2018 module system to 2024 but this would "blur" the original intent of the test and arguably make it confusing to future readers.

Moreover, most tests currently use Rust 2015 by virtue of it being the default meaning stderr files need to be updated as adding an edition directive would shift all lines by one which is likely git-conflict-prone. Admittedly though, that would be a one time thing.

Lastly, most changes brought by editions are minor and don't actually affect that much. In my opinion it doesn't pay off.

Anyway, I didn't intend to write such an elaborate answer, it looks like I'm obsessing over this which is not the case ^^'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-edition-2021 Area: The 2021 edition C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC
Projects
None yet
Development

No branches or pull requests

3 participants