Fix duplicate note on internal feature gate
The BuiltinInternalFeatures gate already has a struct level #[note] attribute. The additional note field in it caused a duplicate to be displayed when it was set to Some(...) which happened when the feature had an associated issue
This commit is contained in:
parent
2e7e0fb838
commit
66e643d0f8
@ -2258,23 +2258,19 @@ fn check_crate(&mut self, cx: &EarlyContext<'_>, _: &ast::Crate) {
|
|||||||
.chain(features.declared_lib_features.iter().map(|(name, span)| (name, span)))
|
.chain(features.declared_lib_features.iter().map(|(name, span)| (name, span)))
|
||||||
.filter(|(&name, _)| features.incomplete(name) || features.internal(name))
|
.filter(|(&name, _)| features.incomplete(name) || features.internal(name))
|
||||||
.for_each(|(&name, &span)| {
|
.for_each(|(&name, &span)| {
|
||||||
|
if features.incomplete(name) {
|
||||||
let note = rustc_feature::find_feature_issue(name, GateIssue::Language)
|
let note = rustc_feature::find_feature_issue(name, GateIssue::Language)
|
||||||
.map(|n| BuiltinFeatureIssueNote { n });
|
.map(|n| BuiltinFeatureIssueNote { n });
|
||||||
|
|
||||||
if features.incomplete(name) {
|
|
||||||
let help =
|
let help =
|
||||||
HAS_MIN_FEATURES.contains(&name).then_some(BuiltinIncompleteFeaturesHelp);
|
HAS_MIN_FEATURES.contains(&name).then_some(BuiltinIncompleteFeaturesHelp);
|
||||||
|
|
||||||
cx.emit_spanned_lint(
|
cx.emit_spanned_lint(
|
||||||
INCOMPLETE_FEATURES,
|
INCOMPLETE_FEATURES,
|
||||||
span,
|
span,
|
||||||
BuiltinIncompleteFeatures { name, note, help },
|
BuiltinIncompleteFeatures { name, note, help },
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
cx.emit_spanned_lint(
|
cx.emit_spanned_lint(INTERNAL_FEATURES, span, BuiltinInternalFeatures { name });
|
||||||
INTERNAL_FEATURES,
|
|
||||||
span,
|
|
||||||
BuiltinInternalFeatures { name, note },
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -412,8 +412,6 @@ pub struct BuiltinIncompleteFeatures {
|
|||||||
#[note]
|
#[note]
|
||||||
pub struct BuiltinInternalFeatures {
|
pub struct BuiltinInternalFeatures {
|
||||||
pub name: Symbol,
|
pub name: Symbol,
|
||||||
#[subdiagnostic]
|
|
||||||
pub note: Option<BuiltinFeatureIssueNote>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Subdiagnostic)]
|
#[derive(Subdiagnostic)]
|
||||||
|
Loading…
Reference in New Issue
Block a user