Function rustc_middle::ty::layout::mul_sorted_consts
source · fn mul_sorted_consts<'tcx>(
tcx: TyCtxt<'tcx>,
param_env: ParamEnv<'tcx>,
a: Const<'tcx>,
b: Const<'tcx>
) -> Option<Const<'tcx>>
Expand description
When creating the layout for types with abstract consts in their size (i.e. [usize; 4 * N]),
to ensure that they have a canonical order and can be compared directly we combine all
constants, and sort the other terms. This allows comparison of expressions of sizes,
allowing for things like transmuting between types that depend on generic consts.
This returns None
if multiplication of constants overflows.