[−][src]Enum rustc_ast_lowering::ImplTraitContext
Context of impl Trait in code, which determines whether it is allowed in an HIR subtree,
and if so, what meaning it has.
Variants
Universal(&'b mut Vec<GenericParam<'a>>)Treat impl Trait as shorthand for a new universal generic parameter.
Example: fn foo(x: impl Debug), where impl Debug is conceptually
equivalent to a fresh universal parameter like fn foo<T: Debug>(x: T).
Newly generated parameters should be inserted into the given Vec.
Treat impl Trait as shorthand for a new opaque type.
Example: fn foo() -> impl Debug, where impl Debug is conceptually
equivalent to a new opaque type like type T = impl Debug; fn foo() -> T.
Fields of ReturnPositionOpaqueTy
fn_def_id: DefIdDefId for the parent function, used to look up necessary
information later.
origin: OpaqueTyOriginOrigin: Either OpaqueTyOrigin::FnReturn or OpaqueTyOrigin::AsyncFn,
Impl trait in type aliases, consts and statics.
Fields of OtherOpaqueTy
capturable_lifetimes: &'b mut FxHashSet<LifetimeName>Set of lifetimes that this opaque type can capture, if it uses them. This includes lifetimes bound since we entered this context. For example, in
type A<'b> = impl for<'a> Trait<'a, Out = impl Sized + 'a>;
the inner opaque type captures 'a because it uses it. It doesn't
need to capture 'b because it already inherits the lifetime
parameter from A.
origin: OpaqueTyOriginOrigin: Either OpaqueTyOrigin::Misc or OpaqueTyOrigin::Binding,
Disallowed(ImplTraitPosition)impl Trait is not accepted in this position.
Implementations
impl<'a, '_> ImplTraitContext<'_, 'a>[src]
pub(crate) fn disallowed() -> Self[src]
pub(crate) fn reborrow<'this>(&'this mut self) -> ImplTraitContext<'this, 'a>[src]
Trait Implementations
impl<'b, 'a> Debug for ImplTraitContext<'b, 'a>[src]
Auto Trait Implementations
impl<'b, 'a> !RefUnwindSafe for ImplTraitContext<'b, 'a>
impl<'b, 'a> !Send for ImplTraitContext<'b, 'a>
impl<'b, 'a> !Sync for ImplTraitContext<'b, 'a>
impl<'b, 'a> Unpin for ImplTraitContext<'b, 'a> where
'a: 'b,
'a: 'b,
impl<'b, 'a> !UnwindSafe for ImplTraitContext<'b, 'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<'a, T> Captures<'a> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,