check mir exists before validation; fix tests

This commit is contained in:
Vishnunarayan K I 2020-11-09 23:15:11 +05:30
parent 6781907444
commit 5029a19313
15 changed files with 25 additions and 90 deletions

View file

@ -275,6 +275,13 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
return Err(ErrorHandled::Reported(error_reported));
}
}
if !tcx.is_mir_available(def.did) {
tcx.sess.delay_span_bug(
tcx.def_span(def.did),
&format!("no MIR body is available for {:?}", def.did),
);
return Err(ErrorHandled::Reported(ErrorReported {}));
}
let qualif = tcx.mir_const_qualif_opt_const_arg(def);
if qualif.error_occured {
return Err(ErrorHandled::Reported(ErrorReported {}));