Module rustc_passes::check_const
source · Expand description
This pass checks HIR bodies that may be evaluated at compile-time (e.g., const
, static
,
const fn
) for structured control flow (e.g. if
, while
), which is forbidden in a const
context.
By the time the MIR const-checker runs, these high-level constructs have been lowered to
control-flow primitives (e.g., Goto
, SwitchInt
), making it tough to properly attribute
errors. We still look for those primitives in the MIR const-checker to ensure nothing slips
through, but errors for structured control flow in a const
should be emitted here.
Structs
Enums
- An expression that is not always legal in a const context.
Functions
- provide 🔒