1
Fork 0

Lint elided lifetimes in path during lifetime resolution.

This commit is contained in:
Camille GILLOT 2021-07-11 15:04:57 +02:00
parent ac03470c3b
commit 5ea7ea8a57
13 changed files with 181 additions and 78 deletions

View file

@ -94,6 +94,9 @@ pub enum LifetimeName {
/// User wrote nothing (e.g., the lifetime in `&u32`).
Implicit,
/// User wrote nothing, but should have provided something.
ImplicitMissing,
/// Implicit lifetime in a context like `dyn Foo`. This is
/// distinguished from implicit lifetimes elsewhere because the
/// lifetime that they default to must appear elsewhere within the
@ -123,6 +126,7 @@ impl LifetimeName {
match *self {
LifetimeName::ImplicitObjectLifetimeDefault
| LifetimeName::Implicit
| LifetimeName::ImplicitMissing
| LifetimeName::Error => Ident::empty(),
LifetimeName::Underscore => Ident::with_dummy_span(kw::UnderscoreLifetime),
LifetimeName::Static => Ident::with_dummy_span(kw::StaticLifetime),
@ -134,6 +138,7 @@ impl LifetimeName {
match self {
LifetimeName::ImplicitObjectLifetimeDefault
| LifetimeName::Implicit
| LifetimeName::ImplicitMissing
| LifetimeName::Underscore => true,
// It might seem surprising that `Fresh(_)` counts as

View file

@ -546,6 +546,7 @@ pub fn walk_lifetime<'v, V: Visitor<'v>>(visitor: &mut V, lifetime: &'v Lifetime
| LifetimeName::Static
| LifetimeName::Error
| LifetimeName::Implicit
| LifetimeName::ImplicitMissing
| LifetimeName::ImplicitObjectLifetimeDefault
| LifetimeName::Underscore => {}
}