Skip to content

Select Rust edition 2024 for compiling Clippy #13751

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 4 commits into from
Jan 13, 2025

Conversation

samueltardieu
Copy link
Contributor

@samueltardieu samueltardieu commented Nov 29, 2024

The Cargo feature is no longer experimental and is enabled by default in our nightly compiler.

changelog: Clippy now uses Rust edition 2024

@rustbot
Copy link
Collaborator

rustbot commented Nov 29, 2024

r? @dswij

rustbot has assigned @dswij.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Nov 29, 2024
@samueltardieu
Copy link
Contributor Author

r? @flip1995

@rustbot rustbot assigned flip1995 and unassigned dswij Nov 29, 2024
@samueltardieu samueltardieu mentioned this pull request Nov 29, 2024
4 tasks
@samueltardieu
Copy link
Contributor Author

The compiler sources still use edition 2021. However, even though the Clippy sources are synced back into the rust-lang repo, I think this would cause no bootstrapping issues as Clippy is always built with the newly built compiler.

@samueltardieu samueltardieu force-pushed the test-edition-2024 branch 2 times, most recently from 7259030 to 08e7fed Compare November 30, 2024 20:57
@flip1995
Copy link
Member

I'll take a closer look at the edition update during the Christmas holidays. Should be good to go, I just want to take the time so that I didn't miss anything.

@samueltardieu samueltardieu force-pushed the test-edition-2024 branch 2 times, most recently from 781c1b9 to 810880e Compare January 10, 2025 16:59
@flip1995 flip1995 added this pull request to the merge queue Jan 10, 2025
@flip1995 flip1995 removed this pull request from the merge queue due to a manual request Jan 10, 2025
Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

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

Now that edition=2024 hit beta, we're definitely good to update it in Clippy.

There are a few more places where we might want to consider to update the edition:

rustfmt.toml
5:edition = "2021"

rustc_tools_util/Cargo.toml
10:edition = "2018"

Cargo.toml
13:edition = "2021"

clippy_dummy/Cargo.toml
4:edition = "2018"

book/src/development/adding_lints.md
540:[author_example]: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=9a12cb60e5c6ad4e3003ac6d5e63cf55
555:[print_hir_example]: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=daf14db3a7f39ca467cd1b86c34b9afb

book/book.toml
9:edition = "2018"

I think updating it in clippy_dummy is not necessary. In the book I'm also not sure. The rest should be updated IMO.

@samueltardieu
Copy link
Contributor Author

I think updating it in clippy_dummy is not necessary. In the book I'm also not sure. The rest should be updated IMO.

I updated everything except clippy_dummy and the book. I had to modify some test files in order to accommodate with gen being a keyword in edition 2024, and to put a std::env::set_var() into an unsafe block. I did this in separate commit to facilitate your review, but I can squash them together if you prefer.

@samueltardieu
Copy link
Contributor Author

Since everything seems to work fine locally, I've also updated the book and clippy_dummy in this latest push.

@samueltardieu
Copy link
Contributor Author

mdbook 0.4.34 doesn't understand edition 2024, I'll try updating it to 0.4.43 which is the latest one and also the one I use locally.

Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

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

Thanks!

@flip1995 flip1995 added this pull request to the merge queue Jan 13, 2025
Merged via the queue into rust-lang:master with commit 6ab6c3c Jan 13, 2025
11 checks passed
@samueltardieu samueltardieu deleted the test-edition-2024 branch January 14, 2025 09:41
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants