1
Fork 0

Move MIR body loading to a machine function

This commit is contained in:
oli 2020-12-07 14:27:46 +00:00
parent f6d54aa0c1
commit caeb3d525d
4 changed files with 34 additions and 10 deletions

View file

@ -477,16 +477,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
if let Some(promoted) = promoted {
return Ok(&self.tcx.promoted_mir_opt_const_arg(def)[promoted]);
}
match instance {
ty::InstanceDef::Item(def) => {
if self.tcx.is_ctfe_mir_available(def.did) {
Ok(self.tcx.mir_for_ctfe_opt_const_arg(def))
} else {
throw_unsup!(NoMirFor(def.did))
}
}
_ => Ok(self.tcx.instance_mir(instance)),
}
M::load_mir(self, instance)
}
/// Call this on things you got out of the MIR (so it is as generic as the current