Module rustc_trait_selection::traits::const_evaluatable[][src]

Expand description

Checking that constant values used in types can be successfully evaluated.

For concrete constants, this is fairly simple as we can just try and evaluate it.

When dealing with polymorphic constants, for example std::mem::size_of::<T>() - 1, this is not as easy.

In this case we try to build an abstract representation of this constant using thir_abstract_const which can then be checked for structural equality with other generic constants mentioned in the caller_bounds of the current environment.

Structs

A tree representing an anonymous constant.

Functions

Check if a given constant can be evaluated.

Builds an abstract const, do not use this directly, but use AbstractConst::new instead.

Tries to unify two abstract constants using structural equality.