Resolve elided lifetimes in assoc const to static if no other lifetimes are in scope
This commit is contained in:
parent
f9515fdd5a
commit
4f97ab54c4
11 changed files with 101 additions and 115 deletions
|
@ -319,11 +319,20 @@ pub(super) fn decorate_lint(sess: &Session, diagnostic: BuiltinLintDiag, diag: &
|
|||
BuiltinLintDiag::UnusedQualifications { removal_span } => {
|
||||
lints::UnusedQualifications { removal_span }.decorate_lint(diag);
|
||||
}
|
||||
BuiltinLintDiag::AssociatedConstElidedLifetime { elided, span: lt_span } => {
|
||||
BuiltinLintDiag::AssociatedConstElidedLifetime {
|
||||
elided,
|
||||
span: lt_span,
|
||||
lifetimes_in_scope,
|
||||
} => {
|
||||
let lt_span = if elided { lt_span.shrink_to_hi() } else { lt_span };
|
||||
let code = if elided { "'static " } else { "'static" };
|
||||
lints::AssociatedConstElidedLifetime { span: lt_span, code, elided }
|
||||
.decorate_lint(diag);
|
||||
lints::AssociatedConstElidedLifetime {
|
||||
span: lt_span,
|
||||
code,
|
||||
elided,
|
||||
lifetimes_in_scope,
|
||||
}
|
||||
.decorate_lint(diag);
|
||||
}
|
||||
BuiltinLintDiag::RedundantImportVisibility { max_vis, span: vis_span, import_vis } => {
|
||||
lints::RedundantImportVisibility { span: vis_span, help: (), max_vis, import_vis }
|
||||
|
|
|
@ -2865,6 +2865,8 @@ pub struct AssociatedConstElidedLifetime {
|
|||
|
||||
pub code: &'static str,
|
||||
pub elided: bool,
|
||||
#[note]
|
||||
pub lifetimes_in_scope: MultiSpan,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue