Skip to main content

## AliasTermKind

# Type Alias AliasTermKind

Source

    pub type AliasTermKind<'tcx> = AliasTermKind<TyCtxt<'tcx>>;

## Aliased Type§

    pub enum AliasTermKind<'tcx> {
        ProjectionTy {
            def_id: DefId,
        },
        InherentTy {
            def_id: DefId,
        },
        OpaqueTy {
            def_id: DefId,
        },
        FreeTy {
            def_id: DefId,
        },
        AnonConst {
            def_id: DefId,
        },
        ProjectionConst {
            def_id: DefId,
        },
        FreeConst {
            def_id: DefId,
        },
        InherentConst {
            def_id: DefId,
        },
    }

## Variants§

§

### ProjectionTy

A projection `<Type as Trait>::AssocType`.

Can get normalized away if monomorphic enough.

The `def_id` is the `DefId` of the `TraitItem` for the associated type.

Note that the `def_id` is not the `DefId` of the `TraitRef` containing this associated type, which is in `interner.associated_item(def_id).container`, aka. `interner.parent(def_id)`.

#### Fields

§`def_id: DefId`
§

### InherentTy

An associated type in an inherent `impl`

The `def_id` is the `DefId` of the `ImplItem` for the associated type.

#### Fields

§`def_id: DefId`
§

### OpaqueTy

An opaque type (usually from `impl Trait` in type aliases or function return types)

`def_id` is the `DefId` of the `OpaqueType` item.

Can only be normalized away in `PostAnalysis` mode or its defining scope.

During codegen, `interner.type_of(def_id)` can be used to get the type of the underlying type if the type is an opaque.

#### Fields

§`def_id: DefId`
§

### FreeTy

A type alias that actually checks its trait bounds.

Currently only used if the type alias references opaque types. Can always be normalized away.

#### Fields

§`def_id: DefId`
§

### AnonConst

An unevaluated anonymous constants.

#### Fields

§`def_id: DefId`
§

### ProjectionConst

An unevaluated const coming from an associated const.

#### Fields

§`def_id: DefId`
§

### FreeConst

A top level const item not part of a trait or impl.

#### Fields

§`def_id: DefId`
§

### InherentConst

An associated const in an inherent `impl`

#### Fields

§`def_id: DefId`

## Layout§

Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.