[−][src]Enum rustc_ast_lowering::AnonymousLifetimeMode

pub(crate) enum AnonymousLifetimeMode {
    CreateParameter,
    ReportError,
    PassThrough,
}

What to do when we encounter an anonymous lifetime reference. Anonymous lifetime references come in two flavors. You have implicit, or fully elided, references to lifetimes, like the one in &T or Ref<T>, and you have '_ lifetimes, like &'_ T or Ref<'_, T>. These often behave the same, but not always:

We describe the effects of the various modes in terms of three cases:

Currently, the handling of lifetime elision is somewhat spread out between HIR lowering and -- as described below -- the resolve_lifetime module. Often we "fallthrough" to that code by generating an "elided" or "underscore" lifetime name. In the future, we probably want to move everything into HIR lowering.

Variants

CreateParameter

For Modern cases, create a new anonymous region parameter and reference that.

For Dyn Bound cases, pass responsibility to resolve_lifetime code.

For Deprecated cases, report an error.

ReportError

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>).

PassThrough

Pass responsibility to resolve_lifetime code for all cases.

Trait Implementations

impl Clone for AnonymousLifetimeMode[src]

impl Copy for AnonymousLifetimeMode[src]

impl Debug for AnonymousLifetimeMode[src]

Auto Trait Implementations

impl RefUnwindSafe for AnonymousLifetimeMode

impl Send for AnonymousLifetimeMode

impl Sync for AnonymousLifetimeMode

impl Unpin for AnonymousLifetimeMode

impl UnwindSafe for AnonymousLifetimeMode

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

impl<'tcx, T> ArenaAllocatable<'tcx, ()> for T where
    T: Copy, 
[src]

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

impl<'a, T> Captures<'a> for T where
    T: ?Sized, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone, 
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.