2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -316,6 +316,9 @@ fn mir_keys(tcx: TyCtxt<'_>, (): ()) -> FxIndexSet<LocalDefId> {
316
316
// All body-owners have MIR associated with them.
317
317
let mut set: FxIndexSet < _ > = tcx. hir_body_owners ( ) . collect ( ) ;
318
318
319
+ // Remove the fake bodies for `global_asm!`, since they're useful to be emitted or encoded.
320
+ set. retain ( |& def_id| !matches ! ( tcx. def_kind( def_id) , DefKind :: GlobalAsm ) ) ;
321
+
319
322
// Coroutine-closures (e.g. async closures) have an additional by-move MIR
320
323
// body that isn't in the HIR.
321
324
for body_owner in tcx. hir_body_owners ( ) {
Original file line number Diff line number Diff line change
1
+ //@ revisions: emit_mir instrument cfi
2
+
3
+ // Make sure we don't try to emit MIR for it.
4
+ //@[emit_mir] compile-flags: --emit=mir
5
+
6
+ // Make sure we don't try to instrument it.
7
+ //@[instrument] compile-flags: -Cinstrument-coverage -Zno-profiler-runtime
8
+
9
+ // Make sure we don't try to CFI encode it.
10
+ //@[cfi] compile-flags: -Zsanitizer=cfi -Ccodegen-units=1 -Clto -Clink-dead-code=true
11
+ //@[cfi] needs-sanitizer-cfi
12
+ //@[cfi] no-prefer-dynamic
13
+
14
+ //@ build-pass
15
+
16
+ use std:: arch:: global_asm;
17
+
18
+ fn foo ( ) { }
19
+
20
+ global_asm ! ( "/* {} */" , sym foo) ;
21
+
22
+ fn main ( ) { }
0 commit comments