Skip to content

Commit 8da4942

Browse files
committed
Add missing ASM arena declaration to librustc_middle
Fixes #72386 This type also needs to get allocated on the `librustc_middle` arena when we deserialize MIR.
1 parent 215f2d3 commit 8da4942

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

src/librustc_middle/arena.rs

+6
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ macro_rules! arena_types {
7676
[few] hir_definitions: rustc_hir::definitions::Definitions,
7777
[] hir_owner: rustc_middle::hir::Owner<$tcx>,
7878
[] hir_owner_nodes: rustc_middle::hir::OwnerNodes<$tcx>,
79+
80+
// Note that this deliberately duplicates items in the `rustc_hir::arena`,
81+
// since we need to allocate this type on both the `rustc_hir` arena
82+
// (during lowering) and the `librustc_middle` arena (for decoding MIR)
83+
[decode] asm_template: rustc_ast::ast::InlineAsmTemplatePiece,
84+
7985
], $tcx);
8086
)
8187
}

src/test/incremental/issue-72386.rs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// revisions: rpass1 cfail1 rpass3
2+
// only-x86_64
3+
// Regression test for issue #72386
4+
// Checks that we don't ICE when switching to an invalid register
5+
// and back again
6+
7+
#![feature(asm)]
8+
9+
#[cfg(any(rpass1, rpass3))]
10+
fn main() {
11+
unsafe {
12+
asm!("nop")
13+
}
14+
}
15+
16+
#[cfg(cfail1)]
17+
fn main() {
18+
unsafe {
19+
asm!("nop",out("invalid_reg")_)
20+
//[cfail1]~^ ERROR invalid register
21+
}
22+
}

0 commit comments

Comments
 (0)