forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#131523 - nbdd0121:asm, r=compiler-errors Fix asm goto with outputs and move it to a separate feature gate Tracking issue: rust-lang#119364 This PR addresses 3 aspects of asm goto with outputs: * Codegen is fixed. My initial implementation has an oversight which cause the output to be only stored in fallthrough path, but not in label blocks. * Outputs can now be used with `options(noreturn)` if a label block is given. * All of this is moved to a new feature gate, because we likely want to stabilise `asm_goto` before asm goto with outputs. `@rustbot` labels: +A-inline-assembly +F-asm
- Loading branch information
Showing
11 changed files
with
178 additions
and
50 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
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
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
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
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
13 changes: 13 additions & 0 deletions
13
tests/ui/feature-gates/feature-gate-asm_goto_with_outputs.rs
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,13 @@ | ||
//@ only-x86_64 | ||
|
||
#![feature(asm_goto)] | ||
|
||
use std::arch::asm; | ||
|
||
fn main() { | ||
let mut _out: u64; | ||
unsafe { | ||
asm!("mov {}, 1", "jmp {}", out(reg) _out, label {}); | ||
//~^ ERROR using both label and output operands for inline assembly is unstable | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
tests/ui/feature-gates/feature-gate-asm_goto_with_outputs.stderr
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,13 @@ | ||
error[E0658]: using both label and output operands for inline assembly is unstable | ||
--> $DIR/feature-gate-asm_goto_with_outputs.rs:10:52 | ||
| | ||
LL | asm!("mov {}, 1", "jmp {}", out(reg) _out, label {}); | ||
| ^^^^^^^^ | ||
| | ||
= note: see issue #119364 <https://github.com/rust-lang/rust/issues/119364> for more information | ||
= help: add `#![feature(asm_goto_with_outputs)]` to the crate attributes to enable | ||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0658`. |