Skip to content

Commit 196d256

Browse files
authored
Rollup merge of #128570 - folkertdev:stabilize-asm-const, r=Amanieu
Stabilize `asm_const` tracking issue: #93332 reference PR: rust-lang/reference#1556 this will probably require some CI wrangling (and a rebase), so let's get that over with even though the final required PR is not merged yet. r? `@ghost`
2 parents fbce03b + 8419c09 commit 196d256

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+276
-367
lines changed

compiler/rustc_ast_lowering/messages.ftl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,6 @@ ast_lowering_underscore_expr_lhs_assign =
175175
.label = `_` not allowed here
176176
177177
ast_lowering_unstable_inline_assembly = inline assembly is not stable yet on this architecture
178-
ast_lowering_unstable_inline_assembly_const_operands =
179-
const operands for inline assembly are unstable
180178
ast_lowering_unstable_inline_assembly_label_operands =
181179
label operands for inline assembly are unstable
182180
ast_lowering_unstable_may_unwind = the `may_unwind` option is unstable

compiler/rustc_ast_lowering/src/asm.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -183,20 +183,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
183183
out_expr: out_expr.as_ref().map(|expr| self.lower_expr(expr)),
184184
}
185185
}
186-
InlineAsmOperand::Const { anon_const } => {
187-
if !self.tcx.features().asm_const {
188-
feature_err(
189-
sess,
190-
sym::asm_const,
191-
*op_sp,
192-
fluent::ast_lowering_unstable_inline_assembly_const_operands,
193-
)
194-
.emit();
195-
}
196-
hir::InlineAsmOperand::Const {
197-
anon_const: self.lower_anon_const_to_anon_const(anon_const),
198-
}
199-
}
186+
InlineAsmOperand::Const { anon_const } => hir::InlineAsmOperand::Const {
187+
anon_const: self.lower_anon_const_to_anon_const(anon_const),
188+
},
200189
InlineAsmOperand::Sym { sym } => {
201190
let static_def_id = self
202191
.resolver

compiler/rustc_codegen_gcc/tests/run/asm.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33
// Run-time:
44
// status: 0
55

6-
#![feature(asm_const)]
7-
8-
#[cfg(target_arch="x86_64")]
6+
#[cfg(target_arch = "x86_64")]
97
use std::arch::{asm, global_asm};
108

11-
#[cfg(target_arch="x86_64")]
9+
#[cfg(target_arch = "x86_64")]
1210
global_asm!(
1311
"
1412
.global add_asm
@@ -22,7 +20,7 @@ extern "C" {
2220
fn add_asm(a: i64, b: i64) -> i64;
2321
}
2422

25-
#[cfg(target_arch="x86_64")]
23+
#[cfg(target_arch = "x86_64")]
2624
pub unsafe fn mem_cpy(dst: *mut u8, src: *const u8, len: usize) {
2725
asm!(
2826
"rep movsb",
@@ -33,7 +31,7 @@ pub unsafe fn mem_cpy(dst: *mut u8, src: *const u8, len: usize) {
3331
);
3432
}
3533

36-
#[cfg(target_arch="x86_64")]
34+
#[cfg(target_arch = "x86_64")]
3735
fn asm() {
3836
unsafe {
3937
asm!("nop");
@@ -178,9 +176,8 @@ fn asm() {
178176
assert_eq!(array1, array2);
179177
}
180178

181-
#[cfg(not(target_arch="x86_64"))]
182-
fn asm() {
183-
}
179+
#[cfg(not(target_arch = "x86_64"))]
180+
fn asm() {}
184181

185182
fn main() {
186183
asm();

compiler/rustc_feature/src/accepted.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ declare_features! (
6060
(accepted, adx_target_feature, "1.61.0", Some(44839)),
6161
/// Allows explicit discriminants on non-unit enum variants.
6262
(accepted, arbitrary_enum_discriminant, "1.66.0", Some(60553)),
63+
/// Allows using `const` operands in inline assembly.
64+
(accepted, asm_const, "CURRENT_RUSTC_VERSION", Some(93332)),
6365
/// Allows using `sym` operands in inline assembly.
6466
(accepted, asm_sym, "1.66.0", Some(93333)),
6567
/// Allows the definition of associated constants in `trait` or `impl` blocks.

compiler/rustc_feature/src/unstable.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,6 @@ declare_features! (
348348
(unstable, alloc_error_handler, "1.29.0", Some(51540)),
349349
/// Allows trait methods with arbitrary self types.
350350
(unstable, arbitrary_self_types, "1.23.0", Some(44874)),
351-
/// Allows using `const` operands in inline assembly.
352-
(unstable, asm_const, "1.58.0", Some(93332)),
353351
/// Enables experimental inline assembly support for additional architectures.
354352
(unstable, asm_experimental_arch, "1.58.0", Some(93335)),
355353
/// Allows using `label` operands in inline assembly.

library/core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,12 @@
193193
//
194194
// Language features:
195195
// tidy-alphabetical-start
196+
#![cfg_attr(bootstrap, feature(asm_const))]
196197
#![cfg_attr(bootstrap, feature(min_exhaustive_patterns))]
197198
#![feature(abi_unadjusted)]
198199
#![feature(adt_const_params)]
199200
#![feature(allow_internal_unsafe)]
200201
#![feature(allow_internal_unstable)]
201-
#![feature(asm_const)]
202202
#![feature(auto_traits)]
203203
#![feature(cfg_sanitize)]
204204
#![feature(cfg_target_has_atomic)]

src/doc/unstable-book/src/language-features/asm-const.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/assembly/asm/global_asm.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
//@ compile-flags: -C llvm-args=--x86-asm-syntax=intel
55
//@ compile-flags: -C symbol-mangling-version=v0
66

7-
#![feature(asm_const)]
87
#![crate_type = "rlib"]
98

109
use std::arch::global_asm;

tests/assembly/asm/msp430-types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//@ compile-flags: --target msp430-none-elf
33
//@ needs-llvm-components: msp430
44

5-
#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch, asm_const)]
5+
#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)]
66
#![crate_type = "rlib"]
77
#![no_core]
88
#![allow(non_camel_case_types)]

tests/ui/asm/aarch64/bad-reg.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//@ only-aarch64
22
//@ compile-flags: -C target-feature=+neon
33

4-
#![feature(asm_const)]
5-
64
use std::arch::asm;
75

86
fn main() {

0 commit comments

Comments
 (0)