fix ICE in pretty-printing global_asm!
This commit is contained in:
parent
4f52199194
commit
9213cb80c2
3 changed files with 22 additions and 1 deletions
|
@ -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),
|
||||
}
|
||||
|
||||
|
|
9
tests/mir-opt/global_asm.rs
Normal file
9
tests/mir-opt/global_asm.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
// skip-filecheck
|
||||
//@ needs-asm-support
|
||||
|
||||
// `global_asm!` gets a fake body, make sure it is handled correctly
|
||||
|
||||
// EMIT_MIR global_asm.{global_asm#0}.SimplifyLocals-final.after.mir
|
||||
core::arch::global_asm!("/* */");
|
||||
|
||||
fn main() {}
|
|
@ -0,0 +1,9 @@
|
|||
// MIR for `{global_asm#0}` after SimplifyLocals-final
|
||||
|
||||
{global_asm#0}: ! = {
|
||||
let mut _0: !;
|
||||
|
||||
bb0: {
|
||||
asm!("/* */", options()) -> unwind unreachable;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue