-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
force-warn for edition lints #85512
Copy link
Copy link
Closed
Labels
A-edition-2021Area: The 2021 editionArea: The 2021 editionA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-edition-2021Area: The 2021 editionArea: The 2021 editionA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
Compiler changes:
--force-warn XXXoption that is given either a lint or lint groupXXXXXXwill always issue warnings, regardless of whether they are "allowed" by the code or command-line optionsCargo fix changes:
cargo fix --editionin order to force migration lints etc to be consideredMotivation
We would like to take some existing warnings and make them into errors in the new edition. We anticipate this being a common pattern. The problem is that these warnings, if they already exist, may be marked a
#[allow]in various code bases. As a result,cargo fixwould not see the migration suggestions and migration would not succeed.Proposed plan
To become part of a migration, existing lints can be directly added into
rust-2021-migrationgroup.Caveat: Multiple groups
This plan means that some lints are members of multiple groups. This has been discouraged but in the past but we currently believe that it should work fine. We should test the scenario where a lint is in two groups and one of those groups is allow.
Alternatives
We could instead introduce a fresh copy of these lints that is a member of
rust_2021_migrations. For example, if there is a lintfoo, maybe we make afoo_2021lint that is specifically for the migration. We could perhaps make this convenient to issue in the code by having some option when creating the lint that is like.migration(RUST_2021_MIGRATioN). This could also make the lint into a hard error automatically in the new edition, regardless of the lint level.