Skip to main content

is_deterministic

Function is_deterministic 

Source
fn is_deterministic(c: Const<'_>) -> bool
Expand description

Return true if any evaluation of this constant in the same MIR body always returns the same value, taking into account even pointer identity tests.

In other words, this answers: is “cloning” the Const ok?

This returns false for constants that synthesize new AllocId when they are instantiated. It is true for anything else, since a given AllocId does have a unique runtime value within the scope of a single MIR body.