Policy for lint expansions #122759
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-lint
Area: Lints (warnings about flaws in source code) such as unused_mut.
C-discussion
Category: Discussion or questions that doesn't represent real issues.
I-lang-nominated
The issue / PR has been nominated for discussion during a lang team meeting.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
Background
When a lint is expanded to include many new cases, it adds significant complexity to the rollout of a toolchain to large codebases. Maintainers of these codebases are stuck with the choice of
Both of these come with the problem of racing with other developers in a codebase who may land new code which triggers the expanded lint in a new compiler, but does not trigger the lint in an old compiler.
While it would be nice to solve this "raciness" once and for all, there are other considerations at play. Instead, we propose to support these users by either providing them with a new lint name to temporarily opt out of OR a machine-applicable fix which eases the pain of any races which might occur.
Note that this requirement only applies to significant lint expansions as measured by crater.
This policy is based on the lang team discussion of #121708.
cc @estebank @petrochenkov
Policy
When an existing lint is expanded to include many new cases, we must provide either:
Exceptions to this policy may be made via Language Team FCP.
Here, we define "many new cases" as impacting more than
5%1% of the top-1000 crates on crates.io. This can be measured by counting the number of regressions from a crater run like the one below.A crater run is not required before landing for every lint expansion. Reviewers should use their best judgment to decide if one is required. However, if a lint expansion lands that violates this requirement, or is strongly suspected to violate this requirement based on other impact, it should be reverted.
Crater command
To measure the impact of a lint as defined by this policy, you can use the following crater command:
@craterbot run name=<name> start=master#<hash1>+rustflags=-D<lint_name> end=master#<hash2>+rustflags=-D<lint_name> crates=top-1000 mode=check-only p=1
See the crater docs for more information.
The text was updated successfully, but these errors were encountered: