pub enum LifetimeElisionKind {
AnonymousCreateParameter {
report_in_path: bool,
},
Elided(Lifetime<Interner>),
AnonymousReportError,
StaticIfNoLifetimeInScope {
only_lint: bool,
},
ElisionFailure,
Infer,
}
Variants§
AnonymousCreateParameter
Create a new anonymous lifetime parameter and reference it.
If report_in_path
, report an error when encountering lifetime elision in a path:
struct Foo<'a> { x: &'a () }
async fn foo(x: Foo) {}
Note: the error should not trigger when the elided lifetime is in a pattern or expression-position path:
struct Foo<'a> { x: &'a () }
async fn foo(Foo { x: _ }: Foo<'_>) {}
Elided(Lifetime<Interner>)
Replace all anonymous lifetimes by provided lifetime.
AnonymousReportError
Give a hard error when either &
or '_
is written. Used to
rule out things like where T: Foo<'_>
. Does not imply an
error on default object bounds (e.g., Box<dyn Foo>
).
StaticIfNoLifetimeInScope
Resolves elided lifetimes to 'static
if there are no other lifetimes in scope,
otherwise give a warning that the previous behavior of introducing a new early-bound
lifetime is a bug and will be removed (if only_lint
is enabled).
ElisionFailure
Signal we cannot find which should be the anonymous lifetime.
Infer
Infer all elided lifetimes.
Trait Implementations§
Source§impl Clone for LifetimeElisionKind
impl Clone for LifetimeElisionKind
Source§fn clone(&self) -> LifetimeElisionKind
fn clone(&self) -> LifetimeElisionKind
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for LifetimeElisionKind
impl RefUnwindSafe for LifetimeElisionKind
impl Send for LifetimeElisionKind
impl Sync for LifetimeElisionKind
impl Unpin for LifetimeElisionKind
impl UnwindSafe for LifetimeElisionKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more