1
Fork 0

rustc_const_eval: adopt let else in more places

This commit is contained in:
est31 2022-02-19 00:47:43 +01:00
parent b8c56fa8c3
commit 5cc292eb1d
13 changed files with 86 additions and 123 deletions

View file

@ -231,9 +231,8 @@ pub fn eval_to_const_value_raw_provider<'tcx>(
// Catch such calls and evaluate them instead of trying to load a constant's MIR.
if let ty::InstanceDef::Intrinsic(def_id) = key.value.instance.def {
let ty = key.value.instance.ty(tcx, key.param_env);
let substs = match ty.kind() {
ty::FnDef(_, substs) => substs,
_ => bug!("intrinsic with type {:?}", ty),
let ty::FnDef(_, substs) = ty.kind() else {
bug!("intrinsic with type {:?}", ty);
};
return eval_nullary_intrinsic(tcx, key.param_env, def_id, substs).map_err(|error| {
let span = tcx.def_span(def_id);