diff options
| author | Gurinder Singh <frederick.the.fool@gmail.com> | 2023-10-12 07:22:41 +0530 |
|---|---|---|
| committer | Gurinder Singh <frederick.the.fool@gmail.com> | 2023-10-12 07:22:41 +0530 |
| commit | 66e643d0f8a6406525ecbf61f8d99005208f97f4 (patch) | |
| tree | 90f8819a436e223547ac2d907a0544f588f2b7a1 | |
| parent | 2e7e0fb83800e66a3266b29744f561c84dc1deaf (diff) | |
| download | rust-66e643d0f8a6406525ecbf61f8d99005208f97f4.tar.gz rust-66e643d0f8a6406525ecbf61f8d99005208f97f4.zip | |
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
| -rw-r--r-- | compiler/rustc_lint/src/builtin.rs | 12 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/lints.rs | 2 |
2 files changed, 4 insertions, 10 deletions
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 536f78a73ed..be9465ba23d 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -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 }); } }); } diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index c776d3bb7fe..594ef97b3ff 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -412,8 +412,6 @@ pub struct BuiltinIncompleteFeatures { #[note] pub struct BuiltinInternalFeatures { pub name: Symbol, - #[subdiagnostic] - pub note: Option<BuiltinFeatureIssueNote>, } #[derive(Subdiagnostic)] |
