pub fn const_scalar_int<'tcx>(
tcx: TyCtxt<'tcx>,
constant: &Const<'tcx>,
text: &str,
) -> Option<i128>Expand description
Resolve a MIR constant to a concrete integer, falling back from the cheap debug-text parse to full const evaluation.
Layout constants (offset_of!(Container, field)) and the T::{BITS,MAX,MIN}
associated constants of small integer types (u8..u32, i8..i32) are
evaluated here. Arbitrary unevaluated consts — and the wide bounds
usize::MAX / u64::MAX / u128::MAX — are deliberately left symbolic:
forcing them to a concrete u64 would overflow downstream size arithmetic.