Rollup merge of #125913 - fmease:early-lints-spruce-up-some-diags, r=Nadrieril
Spruce up the diagnostics of some early lints Implement the various "*(note to myself) in a follow-up PR we should turn parts of this message into a subdiagnostic (help msg or even struct sugg)*" drive-by comments I left in #124417 during my review. For context, before #124417, only a few early lints touched/decorated/customized their diagnostic because the former API made it a bit awkward. Likely because of that, things that should've been subdiagnostics were just crammed into the primary message. This PR rectifies this.
This commit is contained in:
commit
81ff9b5770
32 changed files with 83 additions and 51 deletions
|
@ -340,8 +340,9 @@ pub(super) fn decorate_lint(sess: &Session, diagnostic: BuiltinLintDiag, diag: &
|
|||
lints::MacroUseDeprecated.decorate_lint(diag);
|
||||
}
|
||||
BuiltinLintDiag::UnusedMacroUse => lints::UnusedMacroUse.decorate_lint(diag),
|
||||
BuiltinLintDiag::PrivateExternCrateReexport(ident) => {
|
||||
lints::PrivateExternCrateReexport { ident }.decorate_lint(diag);
|
||||
BuiltinLintDiag::PrivateExternCrateReexport { source: ident, extern_crate_span } => {
|
||||
lints::PrivateExternCrateReexport { ident, sugg: extern_crate_span.shrink_to_lo() }
|
||||
.decorate_lint(diag);
|
||||
}
|
||||
BuiltinLintDiag::UnusedLabel => lints::UnusedLabel.decorate_lint(diag),
|
||||
BuiltinLintDiag::MacroIsPrivate(ident) => {
|
||||
|
|
|
@ -2313,6 +2313,7 @@ pub mod unexpected_cfg_value {
|
|||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(lint_macro_use_deprecated)]
|
||||
#[help]
|
||||
pub struct MacroUseDeprecated;
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
|
@ -2323,6 +2324,8 @@ pub struct UnusedMacroUse;
|
|||
#[diag(lint_private_extern_crate_reexport, code = E0365)]
|
||||
pub struct PrivateExternCrateReexport {
|
||||
pub ident: Ident,
|
||||
#[suggestion(code = "pub ", style = "verbose", applicability = "maybe-incorrect")]
|
||||
pub sugg: Span,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
|
@ -2416,6 +2419,7 @@ pub struct UnknownMacroVariable {
|
|||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(lint_unused_crate_dependency)]
|
||||
#[help]
|
||||
pub struct UnusedCrateDependency {
|
||||
pub extern_crate: Symbol,
|
||||
pub local_crate: Symbol,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue