1
Fork 0

Auto merge of #116628 - gurry:116293-dup-note.rs, r=petrochenkov

Fix duplicate note on internal feature gates with associated issues

Fixes #116293

Note sure if I should add tests because the issue occurs only for feature gates having associated issues and that set of feature gates will change unpredictably leading to an unnecessary churn in tests.
This commit is contained in:
bors 2023-10-12 07:57:51 +00:00
commit 4f05e95452
2 changed files with 4 additions and 10 deletions

View file

@ -2258,23 +2258,19 @@ impl EarlyLintPass for IncompleteInternalFeatures {
.chain(features.declared_lib_features.iter().map(|(name, span)| (name, span)))
.filter(|(&name, _)| features.incomplete(name) || features.internal(name))
.for_each(|(&name, &span)| {
let note = rustc_feature::find_feature_issue(name, GateIssue::Language)
.map(|n| BuiltinFeatureIssueNote { n });
if features.incomplete(name) {
let note = rustc_feature::find_feature_issue(name, GateIssue::Language)
.map(|n| BuiltinFeatureIssueNote { n });
let help =
HAS_MIN_FEATURES.contains(&name).then_some(BuiltinIncompleteFeaturesHelp);
cx.emit_spanned_lint(
INCOMPLETE_FEATURES,
span,
BuiltinIncompleteFeatures { name, note, help },
);
} else {
cx.emit_spanned_lint(
INTERNAL_FEATURES,
span,
BuiltinInternalFeatures { name, note },
);
cx.emit_spanned_lint(INTERNAL_FEATURES, span, BuiltinInternalFeatures { name });
}
});
}

View file

@ -412,8 +412,6 @@ pub struct BuiltinIncompleteFeatures {
#[note]
pub struct BuiltinInternalFeatures {
pub name: Symbol,
#[subdiagnostic]
pub note: Option<BuiltinFeatureIssueNote>,
}
#[derive(Subdiagnostic)]