Skip to content

Add missing ASM arena declarations to librustc_middle #72400

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
  • Loading branch information
Aaron1011 committed May 23, 2020
commit 8da494272f4c162c4a853e325a6bd33a80881ff6
6 changes: 6 additions & 0 deletions src/librustc_middle/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
)
}
Expand Down
22 changes: 22 additions & 0 deletions src/test/incremental/issue-72386.rs
Original file line number Diff line number Diff line change
@@ -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
}
}