Struct rustc_trait_selection::infer::opaque_types::OpaqueTypeDecl
source · [−]pub struct OpaqueTypeDecl<'tcx> {
pub opaque_type: &'tcx TyS<'tcx>,
pub definition_span: Span,
pub concrete_ty: &'tcx TyS<'tcx>,
pub origin: OpaqueTyOrigin,
}Expand description
Information about the opaque types whose values we
are inferring in this function (these are the impl Trait that
appear in the return type).
Fields
opaque_type: &'tcx TyS<'tcx>The opaque type (ty::Opaque) for this declaration.
definition_span: SpanThe span of this particular definition of the opaque type. So for example:
type Foo = impl Baz;
fn bar() -> Foo {
// ^^^ This is the span we are looking for!
}In cases where the fn returns (impl Trait, impl Trait) or
other such combinations, the result is currently
over-approximated, but better than nothing.
concrete_ty: &'tcx TyS<'tcx>The type variable that represents the value of the opaque type that we require. In other words, after we compile this function, we will be created a constraint like:
Foo<'a, T> = ?Cwhere ?C is the value of this type variable. =) It may
naturally refer to the type and lifetime parameters in scope
in this function, though ultimately it should only reference
those that are arguments to Foo in the constraint above. (In
other words, ?C should not include 'b, even though it’s a
lifetime parameter on foo.)
origin: OpaqueTyOriginThe origin of the opaque type.
Auto Trait Implementations
impl<'tcx> !RefUnwindSafe for OpaqueTypeDecl<'tcx>
impl<'tcx> !Send for OpaqueTypeDecl<'tcx>
impl<'tcx> !Sync for OpaqueTypeDecl<'tcx>
impl<'tcx> Unpin for OpaqueTypeDecl<'tcx>
impl<'tcx> !UnwindSafe for OpaqueTypeDecl<'tcx>
Blanket Implementations
sourceimpl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for T where
T: Copy,
impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for T where
T: Copy,
pub fn allocate_on(self, arena: &'a Arena<'tcx>) -> &'a mut T
pub fn allocate_from_iter(
arena: &'a Arena<'tcx>,
iter: impl IntoIterator<Item = T>
) -> &'a mut [T]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 32 bytes