diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-06-24 20:46:03 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-24 20:46:03 +0200 |
| commit | 27819a009da72a5e6d90ae11c93595b32824deba (patch) | |
| tree | 7ac5109082aec371c0427e5ee4cccf4ee84b9700 /compiler/rustc_lint/src/lints.rs | |
| parent | 36b21637e93b038453924d3c66821089e71d8baa (diff) | |
| parent | 6ffd0e6c235f9a28f724ce21bda7a9525a4dac03 (diff) | |
| download | rust-27819a009da72a5e6d90ae11c93595b32824deba.tar.gz rust-27819a009da72a5e6d90ae11c93595b32824deba.zip | |
Rollup merge of #142645 - Urgau:usage-non_upper_case_globals, r=fmease
Also emit suggestions for usages in the `non_upper_case_globals` lint This PR adds suggestions for all the usages of the renamed item in the warning of the `non_upper_case_globals` lint. Fixes https://github.com/rust-lang/rust/issues/124061
Diffstat (limited to 'compiler/rustc_lint/src/lints.rs')
| -rw-r--r-- | compiler/rustc_lint/src/lints.rs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index abdf8e3853b..4d405d915fb 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -1353,6 +1353,8 @@ pub(crate) struct NonUpperCaseGlobal<'a> { pub name: &'a str, #[subdiagnostic] pub sub: NonUpperCaseGlobalSub, + #[subdiagnostic] + pub usages: Vec<NonUpperCaseGlobalSubTool>, } #[derive(Subdiagnostic)] @@ -1362,14 +1364,29 @@ pub(crate) enum NonUpperCaseGlobalSub { #[primary_span] span: Span, }, - #[suggestion(lint_suggestion, code = "{replace}", applicability = "maybe-incorrect")] + #[suggestion(lint_suggestion, code = "{replace}")] Suggestion { #[primary_span] span: Span, + #[applicability] + applicability: Applicability, replace: String, }, } +#[derive(Subdiagnostic)] +#[suggestion( + lint_suggestion, + code = "{replace}", + applicability = "machine-applicable", + style = "tool-only" +)] +pub(crate) struct NonUpperCaseGlobalSubTool { + #[primary_span] + pub(crate) span: Span, + pub(crate) replace: String, +} + // noop_method_call.rs #[derive(LintDiagnostic)] #[diag(lint_noop_method_call)] |
