Skip to content

Commit 4f05e95

Browse files
committedOct 12, 2023
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.
2 parents 3d575a2 + 66e643d commit 4f05e95

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed
 

‎compiler/rustc_lint/src/builtin.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -2258,23 +2258,19 @@ impl EarlyLintPass for IncompleteInternalFeatures {
22582258
.chain(features.declared_lib_features.iter().map(|(name, span)| (name, span)))
22592259
.filter(|(&name, _)| features.incomplete(name) || features.internal(name))
22602260
.for_each(|(&name, &span)| {
2261-
let note = rustc_feature::find_feature_issue(name, GateIssue::Language)
2262-
.map(|n| BuiltinFeatureIssueNote { n });
2263-
22642261
if features.incomplete(name) {
2262+
let note = rustc_feature::find_feature_issue(name, GateIssue::Language)
2263+
.map(|n| BuiltinFeatureIssueNote { n });
22652264
let help =
22662265
HAS_MIN_FEATURES.contains(&name).then_some(BuiltinIncompleteFeaturesHelp);
2266+
22672267
cx.emit_spanned_lint(
22682268
INCOMPLETE_FEATURES,
22692269
span,
22702270
BuiltinIncompleteFeatures { name, note, help },
22712271
);
22722272
} else {
2273-
cx.emit_spanned_lint(
2274-
INTERNAL_FEATURES,
2275-
span,
2276-
BuiltinInternalFeatures { name, note },
2277-
);
2273+
cx.emit_spanned_lint(INTERNAL_FEATURES, span, BuiltinInternalFeatures { name });
22782274
}
22792275
});
22802276
}

‎compiler/rustc_lint/src/lints.rs

-2
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,6 @@ pub struct BuiltinIncompleteFeatures {
412412
#[note]
413413
pub struct BuiltinInternalFeatures {
414414
pub name: Symbol,
415-
#[subdiagnostic]
416-
pub note: Option<BuiltinFeatureIssueNote>,
417415
}
418416

419417
#[derive(Subdiagnostic)]

0 commit comments

Comments
 (0)