Skip to content

Commit 40b57be

Browse files
Don't run MIR unsafeck at all when using -Zthir-unsafeck
1 parent 3bc9dd0 commit 40b57be

File tree

1 file changed

+6
-4
lines changed
  • compiler/rustc_mir/src/transform

1 file changed

+6
-4
lines changed

compiler/rustc_mir/src/transform/mod.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,12 @@ fn mir_const<'tcx>(
259259
}
260260

261261
// Unsafety check uses the raw mir, so make sure it is run.
262-
if let Some(param_did) = def.const_param_did {
263-
tcx.ensure().unsafety_check_result_for_const_arg((def.did, param_did));
264-
} else {
265-
tcx.ensure().unsafety_check_result(def.did);
262+
if !tcx.sess.opts.debugging_opts.thir_unsafeck {
263+
if let Some(param_did) = def.const_param_did {
264+
tcx.ensure().unsafety_check_result_for_const_arg((def.did, param_did));
265+
} else {
266+
tcx.ensure().unsafety_check_result(def.did);
267+
}
266268
}
267269

268270
let mut body = tcx.mir_built(def).steal();

0 commit comments

Comments
 (0)