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

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 mir_abstract_const which can then be checked for structural equality with other generic constants mentioned in the caller_bounds of the current environment.

Structs

AbstractConst

A tree representing an anonymous constant.

AbstractConstBuilder
WorkNode

Functions

is_const_evaluatable

Check if a given constant can be evaluated.

mir_abstract_const

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

try_unify

Tries to unify two abstract constants using structural equality.

try_unify_abstract_consts
walk_abstract_const