Skip to content

Commit 6f9bb55

Browse files
committed
is_trivial_mir: only consider functions
1 parent 85f5cb4 commit 6f9bb55

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

compiler/rustc_mir/src/transform/inline.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,12 @@ pub fn is_trivial_mir(tcx: TyCtxt<'tcx>, did: DefId) -> bool {
874874
return true;
875875
}
876876

877+
use rustc_hir::def::DefKind;
878+
if !matches!(tcx.def_kind(did), DefKind::Fn | DefKind::AssocFn) {
879+
// Only inline functions, don't look at constants here.
880+
return false;
881+
}
882+
877883
if let Some(did) = did.as_local() {
878884
let body = tcx
879885
.mir_drops_elaborated_and_const_checked(ty::WithOptConstParam::unknown(did))

0 commit comments

Comments
 (0)