1
Fork 0

Rollup merge of #138280 - folkertdev:mir-dump-asm-const, r=compiler-errors

fix ICE in pretty-printing `global_asm!`

fixes https://github.com/rust-lang/rust/issues/138260

since https://github.com/rust-lang/rust/pull/137180, `global_asm!` gets a fake body, that the pretty printing logic did not know what to do with.

based on [#t-compiler/help > tests for MIR pretty printing](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/tests.20for.20MIR.20pretty.20printing) I created `tests/ui/unpretty/mir` which seemed as good a place as any for a test. If there is a better place, let me know.

try-job: test-various
try-job: x86_64-apple-2
This commit is contained in:
Manish Goregaokar 2025-03-12 10:19:28 -07:00 committed by GitHub
commit f5eb296c5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 1 deletions

View file

@ -653,7 +653,10 @@ fn write_mir_sig(tcx: TyCtxt<'_>, body: &Body<'_>, w: &mut dyn io::Write) -> io:
write!(w, "static mut ")?
}
(_, _) if is_function => write!(w, "fn ")?,
(DefKind::AnonConst | DefKind::InlineConst, _) => {} // things like anon const, not an item
// things like anon const, not an item
(DefKind::AnonConst | DefKind::InlineConst, _) => {}
// `global_asm!` have fake bodies, which we may dump after mir-build
(DefKind::GlobalAsm, _) => {}
_ => bug!("Unexpected def kind {:?}", kind),
}