-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #87985 - nbdd0121:asm, r=Amanieu
Forbid `!` from being used in `asm!` output Fixes #87802 r? `@Amanieu`
- Loading branch information
Showing
3 changed files
with
37 additions
and
5 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,17 @@ | ||
// only-x86_64 | ||
// Make sure rustc doesn't ICE on asm! when output type is !. | ||
|
||
#![feature(asm)] | ||
|
||
fn hmm() -> ! { | ||
let x; | ||
unsafe { | ||
asm!("/* {0} */", out(reg) x); | ||
//~^ ERROR cannot use value of type `!` for inline assembly | ||
} | ||
x | ||
} | ||
|
||
fn main() { | ||
hmm(); | ||
} |
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,10 @@ | ||
error: cannot use value of type `!` for inline assembly | ||
--> $DIR/issue-87802.rs:9:36 | ||
| | ||
LL | asm!("/* {0} */", out(reg) x); | ||
| ^ | ||
| | ||
= note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly | ||
|
||
error: aborting due to previous error | ||
|