Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 64a26e8

Browse files
committedDec 4, 2024
Stabilize asm_goto
1 parent 96e51d9 commit 64a26e8

15 files changed

+36
-80
lines changed
 

‎compiler/rustc_ast_lowering/messages.ftl

-2
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,6 @@ ast_lowering_underscore_expr_lhs_assign =
185185
ast_lowering_unstable_inline_assembly = inline assembly is not stable yet on this architecture
186186
ast_lowering_unstable_inline_assembly_label_operand_with_outputs =
187187
using both label and output operands for inline assembly is unstable
188-
ast_lowering_unstable_inline_assembly_label_operands =
189-
label operands for inline assembly are unstable
190188
ast_lowering_unstable_may_unwind = the `may_unwind` option is unstable
191189
192190
ast_lowering_use_angle_brackets = use angle brackets instead

‎compiler/rustc_ast_lowering/src/asm.rs

+2-13
Original file line numberDiff line numberDiff line change
@@ -479,22 +479,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
479479
}
480480
}
481481

482-
// Feature gate checking for asm goto.
482+
// Feature gate checking for `asm_goto_with_outputs`.
483483
if let Some((_, op_sp)) =
484484
operands.iter().find(|(op, _)| matches!(op, hir::InlineAsmOperand::Label { .. }))
485485
{
486-
if !self.tcx.features().asm_goto() {
487-
feature_err(
488-
sess,
489-
sym::asm_goto,
490-
*op_sp,
491-
fluent::ast_lowering_unstable_inline_assembly_label_operands,
492-
)
493-
.emit();
494-
}
495-
496-
// In addition, check if an output operand is used.
497-
// This is gated behind an additional feature.
486+
// Check if an output operand is used.
498487
let output_operand_used = operands.iter().any(|(op, _)| {
499488
matches!(
500489
op,

‎compiler/rustc_feature/src/accepted.rs

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ declare_features! (
6262
(accepted, arbitrary_enum_discriminant, "1.66.0", Some(60553)),
6363
/// Allows using `const` operands in inline assembly.
6464
(accepted, asm_const, "1.82.0", Some(93332)),
65+
/// Allows using `label` operands in inline assembly.
66+
(accepted, asm_goto, "CURRENT_RUSTC_VERSION", Some(119364)),
6567
/// Allows using `sym` operands in inline assembly.
6668
(accepted, asm_sym, "1.66.0", Some(93333)),
6769
/// Allows the definition of associated constants in `trait` or `impl` blocks.

‎compiler/rustc_feature/src/unstable.rs

-2
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,6 @@ declare_features! (
378378
(unstable, asm_experimental_arch, "1.58.0", Some(93335)),
379379
/// Enables experimental register support in inline assembly.
380380
(unstable, asm_experimental_reg, "CURRENT_RUSTC_VERSION", Some(133416)),
381-
/// Allows using `label` operands in inline assembly.
382-
(unstable, asm_goto, "1.78.0", Some(119364)),
383381
/// Allows using `label` operands in inline assembly together with output operands.
384382
(unstable, asm_goto_with_outputs, "CURRENT_RUSTC_VERSION", Some(119364)),
385383
/// Allows the `may_unwind` option in inline assembly.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# `asm_goto_with_outputs`
2+
3+
The tracking issue for this feature is: [#119364]
4+
5+
[#119364]: https://github.com/rust-lang/rust/issues/119364
6+
7+
------------------------
8+
9+
This feature allows label operands to be used together with output operands.
10+
11+
Example:
12+
```rust,ignore (partial-example, x86-only)
13+
14+
unsafe {
15+
let a: usize;
16+
asm!(
17+
"mov {}, 1"
18+
"jmp {}",
19+
out(reg) a,
20+
label {
21+
println!("Jumped from asm {}!", a);
22+
}
23+
);
24+
}
25+
```
26+
27+
The output operands are assigned before the label blocks are executed.

‎src/doc/unstable-book/src/language-features/asm-goto.md

-32
This file was deleted.

‎tests/codegen/asm/goto.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//@ only-x86_64
33

44
#![crate_type = "rlib"]
5-
#![feature(asm_goto, asm_goto_with_outputs)]
5+
#![feature(asm_goto_with_outputs)]
66

77
use std::arch::asm;
88

‎tests/ui/asm/x86_64/bad-options.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ only-x86_64
22

3-
#![feature(asm_unwind, asm_goto)]
3+
#![feature(asm_unwind)]
44

55
use std::arch::{asm, global_asm};
66

‎tests/ui/asm/x86_64/goto-block-safe.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
//@ needs-asm-support
33

44
#![deny(unreachable_code)]
5-
#![feature(asm_goto)]
65

76
use std::arch::asm;
87

‎tests/ui/asm/x86_64/goto-block-safe.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0133]: call to unsafe function `unreachable_unchecked` is unsafe and requires unsafe function or block
2-
--> $DIR/goto-block-safe.rs:14:17
2+
--> $DIR/goto-block-safe.rs:13:17
33
|
44
LL | unsafe {
55
| ------ items do not inherit unsafety from separate enclosing items

‎tests/ui/asm/x86_64/goto.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//@ needs-asm-support
44

55
#![deny(unreachable_code)]
6-
#![feature(asm_goto, asm_goto_with_outputs)]
6+
#![feature(asm_goto_with_outputs)]
77

88
use std::arch::asm;
99

‎tests/ui/feature-gates/feature-gate-asm_goto.rs

-10
This file was deleted.

‎tests/ui/feature-gates/feature-gate-asm_goto.stderr

-13
This file was deleted.

‎tests/ui/feature-gates/feature-gate-asm_goto_with_outputs.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ only-x86_64
22

3-
#![feature(asm_goto)]
4-
53
use std::arch::asm;
64

75
fn main() {

‎tests/ui/feature-gates/feature-gate-asm_goto_with_outputs.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: using both label and output operands for inline assembly is unstable
2-
--> $DIR/feature-gate-asm_goto_with_outputs.rs:10:52
2+
--> $DIR/feature-gate-asm_goto_with_outputs.rs:8:52
33
|
44
LL | asm!("mov {}, 1", "jmp {}", out(reg) _out, label {});
55
| ^^^^^^^^

0 commit comments

Comments
 (0)
Failed to load comments.