Don't run MIR unsafeck at all when using -Zthir-unsafeck

This commit is contained in:
LeSeulArtichaut 2021-07-27 19:47:39 +02:00
parent 3bc9dd0dd2
commit 40b57be547

View File

@ -259,10 +259,12 @@ fn mir_const<'tcx>(
}
// Unsafety check uses the raw mir, so make sure it is run.
if let Some(param_did) = def.const_param_did {
tcx.ensure().unsafety_check_result_for_const_arg((def.did, param_did));
} else {
tcx.ensure().unsafety_check_result(def.did);
if !tcx.sess.opts.debugging_opts.thir_unsafeck {
if let Some(param_did) = def.const_param_did {
tcx.ensure().unsafety_check_result_for_const_arg((def.did, param_did));
} else {
tcx.ensure().unsafety_check_result(def.did);
}
}
let mut body = tcx.mir_built(def).steal();