pub struct OpaqueTypeDecl<'tcx> {
    pub opaque_type: Ty<'tcx>,
    pub definition_span: Span,
    pub concrete_ty: Ty<'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: Ty<'tcx>

The opaque type (ty::Opaque) for this declaration.

definition_span: Span

The 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: Ty<'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> = ?C

where ?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: OpaqueTyOrigin

The origin of the opaque type.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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