rustc_middle::ty::consts

Type Alias ConstKind

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

Aliased Type§

enum ConstKind<'tcx> {
    Param(ParamConst),
    Infer(InferConst),
    Bound(DebruijnIndex, BoundVar),
    Placeholder(Placeholder<BoundVar>),
    Unevaluated(UnevaluatedConst<TyCtxt<'tcx>>),
    Value(Ty<'tcx>, ValTree<'tcx>),
    Error(ErrorGuaranteed),
    Expr(Expr<'tcx>),
}

Variants§

§

Param(ParamConst)

A const generic parameter.

§

Infer(InferConst)

Infer the value of the const.

§

Bound(DebruijnIndex, BoundVar)

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

§

Placeholder(Placeholder<BoundVar>)

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(Ty<'tcx>, ValTree<'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: 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

Size for each variant:

  • Param: 12 bytes
  • Infer: 12 bytes
  • Bound: 12 bytes
  • Placeholder: 12 bytes
  • Unevaluated: 24 bytes
  • Value: 32 bytes
  • Error: 0 bytes
  • Expr: 24 bytes