]> git.lizzy.rs Git - rust.git/commitdiff
Add missing ASM arena declaration to librustc_middle
authorAaron Hill <aa1ronham@gmail.com>
Wed, 20 May 2020 21:39:19 +0000 (17:39 -0400)
committerAaron Hill <aa1ronham@gmail.com>
Sat, 23 May 2020 19:50:37 +0000 (15:50 -0400)
Fixes #72386

This type also needs to get allocated on the `librustc_middle` arena
when we deserialize MIR.

src/librustc_middle/arena.rs
src/test/incremental/issue-72386.rs [new file with mode: 0644]

index a97db3134dc9e97fcd7be67da34bb7a563448649..2df878c3fb2201df961339ca06848d88cc74a10a 100644 (file)
@@ -76,6 +76,12 @@ macro_rules! arena_types {
             [few] hir_definitions: rustc_hir::definitions::Definitions,
             [] hir_owner: rustc_middle::hir::Owner<$tcx>,
             [] hir_owner_nodes: rustc_middle::hir::OwnerNodes<$tcx>,
+
+            // Note that this deliberately duplicates items in the `rustc_hir::arena`,
+            // since we need to allocate this type on both the `rustc_hir` arena
+            // (during lowering) and the `librustc_middle` arena (for decoding MIR)
+            [decode] asm_template: rustc_ast::ast::InlineAsmTemplatePiece,
+
         ], $tcx);
     )
 }
diff --git a/src/test/incremental/issue-72386.rs b/src/test/incremental/issue-72386.rs
new file mode 100644 (file)
index 0000000..3dc7f50
--- /dev/null
@@ -0,0 +1,22 @@
+// revisions: rpass1 cfail1 rpass3
+// only-x86_64
+// Regression test for issue #72386
+// Checks that we don't ICE when switching to an invalid register
+// and back again
+
+#![feature(asm)]
+
+#[cfg(any(rpass1, rpass3))]
+fn main() {
+    unsafe {
+        asm!("nop")
+    }
+}
+
+#[cfg(cfail1)]
+fn main() {
+    unsafe {
+        asm!("nop",out("invalid_reg")_)
+        //[cfail1]~^ ERROR invalid register
+    }
+}