1
Fork 0

Rollup merge of #125258 - compiler-errors:static-if-no-lt, r=nnethercote

Resolve elided lifetimes in assoc const to static if no other lifetimes are in scope

Implements the change to elided lifetime resolution in *associated consts* subject to FCP here: https://github.com/rust-lang/rust/issues/125190#issue-2301532282

Specifically, walk the enclosing lifetime ribs in an associated const, and if we find no other lifetimes, then resolve to `'static`.

Also make it work for traits, but don't lint -- just give a hard error in that case.
This commit is contained in:
许杰友 Jieyou Xu (Joe) 2024-06-17 04:53:54 +01:00 committed by GitHub
commit 23b936f981
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 385 additions and 209 deletions

View file

@ -2873,6 +2873,8 @@ pub struct AssociatedConstElidedLifetime {
pub code: &'static str,
pub elided: bool,
#[note]
pub lifetimes_in_scope: MultiSpan,
}
#[derive(LintDiagnostic)]