ConstKind in rustc_middle::ty - Rust
Description: API documentation for the Rust `ConstKind` type in crate `rustc_middle`.

Skip to main content

## ConstKind

# Type Alias ConstKind

Source

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

## Aliased Type§

    pub enum ConstKind<'tcx> {
        Param(ParamConst),
        Infer(InferConst),
        Bound(BoundVarIndexKind, BoundConst<TyCtxt<'tcx>>),
        Placeholder(Placeholder<TyCtxt<'tcx>, BoundConst<TyCtxt<'tcx>>>),
        Unevaluated(UnevaluatedConst<TyCtxt<'tcx>>),
        Value(Value<'tcx>),
        Error(ErrorGuaranteed),
        Expr(Expr<'tcx>),
    }

## Variants§

§

### Param(ParamConst)

A const generic parameter.

§

### Infer(InferConst)

Infer the value of the const.

§

### Bound(BoundVarIndexKind, BoundConst<TyCtxt<'tcx>>)

Bound const variable, used only when preparing a trait query.

§

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

A placeholder const - universally quantified higher-ranked const.

§

### Unevaluated(UnevaluatedConst<TyCtxt<'tcx>>)

An unnormalized const item such as an anon const or assoc const or free const item. Right now anything other than anon consts does not actually work properly but this should

§

### Value(Value<'tcx>)

Used to hold computed value.

§

### Error(ErrorGuaranteed)

A placeholder for a const which could not be computed; this is propagated to avoid useless error messages.

§

### Expr(Expr<'tcx>)

Unevaluated non-const-item, used by `feature(generic_const_exprs)` to represent const arguments such as `N + 1` or `foo(N)`

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