rustc_trait_selection::traits

Module const_evaluatable

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

Functionsยง