about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/lib.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2025-02-23 23:01:04 +0000
committerMichael Goulet <michael@errs.io>2025-03-06 17:34:17 +0000
commitef031c854da6432c86ac14c438ab96c7e349d85f (patch)
tree1dfab8c17e41decabcbd431c05e57a83ec849936 /compiler/rustc_mir_transform/src/lib.rs
parentc867b8f11dbf0be397ba9b5c898fde95f8d5ea6c (diff)
downloadrust-ef031c854da6432c86ac14c438ab96c7e349d85f.tar.gz
rust-ef031c854da6432c86ac14c438ab96c7e349d85f.zip
Exclude global_asm from mir_keys
Diffstat (limited to 'compiler/rustc_mir_transform/src/lib.rs')
-rw-r--r--compiler/rustc_mir_transform/src/lib.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs
index 5df12ac4d8b..8aa14d15644 100644
--- a/compiler/rustc_mir_transform/src/lib.rs
+++ b/compiler/rustc_mir_transform/src/lib.rs
@@ -316,6 +316,10 @@ fn mir_keys(tcx: TyCtxt<'_>, (): ()) -> FxIndexSet<LocalDefId> {
     // All body-owners have MIR associated with them.
     let mut set: FxIndexSet<_> = tcx.hir_body_owners().collect();
 
+    // Remove the fake bodies for `global_asm!`, since they're not useful
+    // to be emitted (`--emit=mir`) or encoded (in metadata).
+    set.retain(|&def_id| !matches!(tcx.def_kind(def_id), DefKind::GlobalAsm));
+
     // Coroutine-closures (e.g. async closures) have an additional by-move MIR
     // body that isn't in the HIR.
     for body_owner in tcx.hir_body_owners() {