CanonicalVarKind in rustc_middle::infer::canonical - Rust
Description: API documentation for the Rust `CanonicalVarKind` type in crate `rustc_middle`.

Skip to main content

## CanonicalVarKind

# Type Alias CanonicalVarKind

Source

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

## Aliased Type§

    pub enum CanonicalVarKind<'tcx> {
        Ty {
            ui: UniverseIndex,
            sub_root: BoundVar,
        },
        Int,
        Float,
        PlaceholderTy(Placeholder<TyCtxt<'tcx>, BoundTy<TyCtxt<'tcx>>>),
        Region(UniverseIndex),
        PlaceholderRegion(Placeholder<TyCtxt<'tcx>, BoundRegion<TyCtxt<'tcx>>>),
        Const(UniverseIndex),
        PlaceholderConst(Placeholder<TyCtxt<'tcx>, BoundConst<TyCtxt<'tcx>>>),
    }

## Variants§

§

### Ty

General type variable `?T` that can be unified with arbitrary types.

We also store the index of the first type variable which is sub-unified with this one. If there is no inference variable related to this one, its `sub_root` just points to itself.

#### Fields

§`ui: UniverseIndex`
§`sub_root: BoundVar`
§

### Int

Integral type variable `?I` (that can only be unified with integral types).

§

### Float

Floating-point type variable `?F` (that can only be unified with float types).

§

### PlaceholderTy(Placeholder<TyCtxt<'tcx>, BoundTy<TyCtxt<'tcx>>>)

A “placeholder” that represents “any type”.

§

### Region(UniverseIndex)

Region variable `'?R`.

§

### PlaceholderRegion(Placeholder<TyCtxt<'tcx>, BoundRegion<TyCtxt<'tcx>>>)

A “placeholder” that represents “any region”. Created when you are solving a goal like `for<'a> T: Foo<'a>` to represent the bound region `'a`.

§

### Const(UniverseIndex)

Some kind of const inference variable.

§

### PlaceholderConst(Placeholder<TyCtxt<'tcx>, BoundConst<TyCtxt<'tcx>>>)

A “placeholder” that represents “any const”.

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