forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix ICE when
asm_const
and const_refs_to_static
are combined
- Loading branch information
1 parent
f7679d0
commit 49e3b9a
Showing
3 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//@ needs-asm-support | ||
//@ ignore-nvptx64 | ||
//@ ignore-spirv | ||
|
||
#![feature(const_refs_to_static)] | ||
|
||
use std::arch::{asm, global_asm}; | ||
use std::ptr::addr_of; | ||
|
||
static FOO: u8 = 42; | ||
|
||
global_asm!("{}", const addr_of!(FOO)); | ||
//~^ ERROR invalid type for `const` operand | ||
|
||
#[no_mangle] | ||
fn inline() { | ||
unsafe { asm!("{}", const addr_of!(FOO)) }; | ||
//~^ ERROR invalid type for `const` operand | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
error: invalid type for `const` operand | ||
--> $DIR/const-refs-to-static.rs:12:19 | ||
| | ||
LL | global_asm!("{}", const addr_of!(FOO)); | ||
| ^^^^^^------------- | ||
| | | ||
| is a `*const u8` | ||
| | ||
= help: `const` operands must be of an integer type | ||
|
||
error: invalid type for `const` operand | ||
--> $DIR/const-refs-to-static.rs:17:25 | ||
| | ||
LL | unsafe { asm!("{}", const addr_of!(FOO)) }; | ||
| ^^^^^^------------- | ||
| | | ||
| is a `*const u8` | ||
| | ||
= help: `const` operands must be of an integer type | ||
|
||
error: aborting due to 2 previous errors | ||
|