-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Lint against overlapping pattern ranges and pattern ranges with small holes caught by _ #63987
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.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.T-langRelevant to the language teamRelevant to the language team
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.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.T-langRelevant to the language teamRelevant to the language team
Type
Fields
Give feedbackNo fields configured for issues without a type.
For both exclusive(nightly) and inclusive range patterns, we don't have any lint about overlapping ranges. We probably should complain about
100..=500being partially covered already. This would minimize the likelihood of the following off-by-one error going unnoticed:It would also be interesting to have a 1 or 2 value wide holes detection in the presence of a
_pattern to detect confusion between exclusive and inclusive ranges:We already have range coverage checks when not using
_:We might want to just lint against
_and instead ask to be explicit to handle the "small holes" case.CC #37854 for the
exclusive_range_patterncase.