Skip to content

Commit c88bcf3

Browse files
committed
Check def_kind before is_mir_available
1 parent 3684d88 commit c88bcf3

File tree

1 file changed

+4
-4
lines changed
  • compiler/rustc_mir_transform/src

1 file changed

+4
-4
lines changed

compiler/rustc_mir_transform/src/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -360,16 +360,16 @@ fn mir_promoted(
360360

361361
fn mir_flags<'tcx>(tcx: TyCtxt<'tcx>, local_def_id: LocalDefId) -> MirFlags {
362362
let mut flags = MirFlags::default();
363-
if !tcx.is_mir_available(local_def_id) {
364-
return flags;
365-
}
366-
367363
// Only perform check on functions because constants cannot call FFI functions.
368364
let kind = tcx.def_kind(local_def_id);
369365
if !kind.is_fn_like() {
370366
return flags;
371367
}
372368

369+
if !tcx.is_mir_available(local_def_id) {
370+
return flags;
371+
}
372+
373373
let body = &*tcx.mir_promoted(local_def_id).0.borrow();
374374

375375
if is_nounwind(body) {

0 commit comments

Comments
 (0)