Implement elided_named_lifetimes
lint
This commit is contained in:
parent
0d634185df
commit
5d04472461
10 changed files with 154 additions and 20 deletions
|
@ -10,6 +10,7 @@ use rustc_errors::{
|
|||
use rustc_middle::middle::stability;
|
||||
use rustc_session::lint::BuiltinLintDiag;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::symbol::kw;
|
||||
use rustc_span::BytePos;
|
||||
use tracing::debug;
|
||||
|
||||
|
@ -441,5 +442,17 @@ pub(super) fn decorate_lint(sess: &Session, diagnostic: BuiltinLintDiag, diag: &
|
|||
BuiltinLintDiag::UnexpectedBuiltinCfg { cfg, cfg_name, controlled_by } => {
|
||||
lints::UnexpectedBuiltinCfg { cfg, cfg_name, controlled_by }.decorate_lint(diag)
|
||||
}
|
||||
BuiltinLintDiag::ElidedIsStatic { elided } => {
|
||||
lints::ElidedNamedLifetime { elided, name: kw::StaticLifetime, named_declaration: None }
|
||||
.decorate_lint(diag)
|
||||
}
|
||||
BuiltinLintDiag::ElidedIsParam { elided, param: (param_name, param_span) } => {
|
||||
lints::ElidedNamedLifetime {
|
||||
elided,
|
||||
name: param_name,
|
||||
named_declaration: Some(param_span),
|
||||
}
|
||||
.decorate_lint(diag)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2611,6 +2611,16 @@ pub(crate) struct ElidedLifetimesInPaths {
|
|||
pub subdiag: ElidedLifetimeInPathSubdiag,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(lint_elided_named_lifetime)]
|
||||
pub(crate) struct ElidedNamedLifetime {
|
||||
#[label(lint_label_elided)]
|
||||
pub elided: Span,
|
||||
pub name: Symbol,
|
||||
#[label(lint_label_named)]
|
||||
pub named_declaration: Option<Span>,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(lint_invalid_crate_type_value)]
|
||||
pub(crate) struct UnknownCrateTypes {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue