Skip to content

Commit 6e7d206

Browse files
authored
Rollup merge of #103168 - Amanieu:stable_asm_sym, r=davidtwco
Stabilize asm_sym Tracking issue #93333 Reference PR: rust-lang/reference#1270
2 parents b411b88 + 430bd62 commit 6e7d206

39 files changed

+61
-114
lines changed

compiler/rustc_ast_lowering/src/asm.rs

-10
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
192192
}
193193
}
194194
InlineAsmOperand::Sym { ref sym } => {
195-
if !self.tcx.features().asm_sym {
196-
feature_err(
197-
&sess.parse_sess,
198-
sym::asm_sym,
199-
*op_sp,
200-
"sym operands for inline assembly are unstable",
201-
)
202-
.emit();
203-
}
204-
205195
let static_def_id = self
206196
.resolver
207197
.get_partial_res(sym.id)

compiler/rustc_codegen_gcc/tests/run/asm.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
// Run-time:
44
// status: 0
55

6-
#![feature(asm_const, asm_sym)]
6+
#![feature(asm_const)]
77

88
use std::arch::{asm, global_asm};
99

10-
global_asm!("
10+
global_asm!(
11+
"
1112
.global add_asm
1213
add_asm:
1314
mov rax, rdi
@@ -132,7 +133,9 @@ fn main() {
132133
assert_eq!(x, 43);
133134

134135
// check sym fn
135-
extern "C" fn foo() -> u64 { 42 }
136+
extern "C" fn foo() -> u64 {
137+
42
138+
}
136139
let x: u64;
137140
unsafe {
138141
asm!("call {}", sym foo, lateout("rax") x);

compiler/rustc_feature/src/accepted.rs

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ declare_features! (
5353
(accepted, abi_sysv64, "1.24.0", Some(36167), None),
5454
/// Allows using ADX intrinsics from `core::arch::{x86, x86_64}`.
5555
(accepted, adx_target_feature, "1.61.0", Some(44839), None),
56+
/// Allows using `sym` operands in inline assembly.
57+
(accepted, asm_sym, "CURRENT_RUSTC_VERSION", Some(93333), None),
5658
/// Allows the definition of associated constants in `trait` or `impl` blocks.
5759
(accepted, associated_consts, "1.20.0", Some(29646), None),
5860
/// Allows using associated `type`s in `trait`s.

compiler/rustc_feature/src/active.rs

-2
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,6 @@ declare_features! (
300300
(active, asm_const, "1.58.0", Some(93332), None),
301301
/// Enables experimental inline assembly support for additional architectures.
302302
(active, asm_experimental_arch, "1.58.0", Some(93335), None),
303-
/// Allows using `sym` operands in inline assembly.
304-
(active, asm_sym, "1.58.0", Some(93333), None),
305303
/// Allows the `may_unwind` option in inline assembly.
306304
(active, asm_unwind, "1.58.0", Some(93334), None),
307305
/// Allows users to enforce equality of associated constants `TraitImpl<AssocConst=3>`.

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

-13
This file was deleted.

src/test/assembly/asm/aarch64-types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// compile-flags: --target aarch64-unknown-linux-gnu
33
// needs-llvm-components: aarch64
44

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

src/test/assembly/asm/arm-types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// compile-flags: -C target-feature=+neon
44
// needs-llvm-components: arm
55

6-
#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_sym)]
6+
#![feature(no_core, lang_items, rustc_attrs, repr_simd)]
77
#![crate_type = "rlib"]
88
#![no_core]
99
#![allow(asm_sub_register, non_camel_case_types)]

src/test/assembly/asm/avr-types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// compile-flags: --target avr-unknown-gnu-atmega328
33
// needs-llvm-components: avr
44

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

src/test/assembly/asm/bpf-types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// compile-flags: --target bpfel-unknown-none -C target_feature=+alu32
33
// needs-llvm-components: bpf
44

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

src/test/assembly/asm/global_asm.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// compile-flags: -C llvm-args=--x86-asm-syntax=intel
55
// compile-flags: -C symbol-mangling-version=v0
66

7-
#![feature(asm_const, asm_sym)]
7+
#![feature(asm_const)]
88
#![crate_type = "rlib"]
99

1010
use std::arch::global_asm;
@@ -28,4 +28,6 @@ global_asm!("lea rax, [rip + {}]", sym MY_STATIC);
2828
// CHECK: call _RNvCsiubXh4Yz005_10global_asm6foobar
2929
global_asm!("call {}", sym foobar);
3030
// CHECK: _RNvCsiubXh4Yz005_10global_asm6foobar:
31-
fn foobar() { loop {} }
31+
fn foobar() {
32+
loop {}
33+
}

src/test/assembly/asm/hexagon-types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// compile-flags: --target hexagon-unknown-linux-musl
33
// needs-llvm-components: hexagon
44

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

src/test/assembly/asm/mips-types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//[mips64] compile-flags: --target mips64-unknown-linux-gnuabi64
66
//[mips64] needs-llvm-components: mips
77

8-
#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_sym, asm_experimental_arch)]
8+
#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)]
99
#![crate_type = "rlib"]
1010
#![no_core]
1111
#![allow(asm_sub_register, non_camel_case_types)]

src/test/assembly/asm/msp430-types.rs

+1-1
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_sym, asm_experimental_arch, asm_const)]
5+
#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch, asm_const)]
66
#![crate_type = "rlib"]
77
#![no_core]
88
#![allow(non_camel_case_types)]

src/test/assembly/asm/nvptx-types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// compile-flags: --crate-type cdylib
44
// needs-llvm-components: nvptx
55

6-
#![feature(no_core, lang_items, rustc_attrs, asm_sym, asm_experimental_arch)]
6+
#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)]
77
#![no_core]
88

99
#[rustc_builtin_macro]

src/test/assembly/asm/powerpc-types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//[powerpc64] compile-flags: --target powerpc64-unknown-linux-gnu
66
//[powerpc64] needs-llvm-components: powerpc
77

8-
#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_sym, asm_experimental_arch)]
8+
#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)]
99
#![crate_type = "rlib"]
1010
#![no_core]
1111
#![allow(asm_sub_register, non_camel_case_types)]

src/test/assembly/asm/riscv-types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//[riscv32] needs-llvm-components: riscv
77
// compile-flags: -C target-feature=+d
88

9-
#![feature(no_core, lang_items, rustc_attrs, asm_sym)]
9+
#![feature(no_core, lang_items, rustc_attrs)]
1010
#![crate_type = "rlib"]
1111
#![no_core]
1212
#![allow(asm_sub_register)]

src/test/assembly/asm/s390x-types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//[s390x] compile-flags: --target s390x-unknown-linux-gnu
44
//[s390x] needs-llvm-components: systemz
55

6-
#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_sym, asm_experimental_arch)]
6+
#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)]
77
#![crate_type = "rlib"]
88
#![no_core]
99
#![allow(asm_sub_register, non_camel_case_types)]

src/test/assembly/asm/wasm-types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// compile-flags: --crate-type cdylib
44
// needs-llvm-components: webassembly
55

6-
#![feature(no_core, lang_items, rustc_attrs, asm_sym, asm_experimental_arch)]
6+
#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)]
77
#![no_core]
88

99
#[rustc_builtin_macro]

src/test/assembly/asm/x86-types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// compile-flags: -C llvm-args=--x86-asm-syntax=intel
88
// compile-flags: -C target-feature=+avx512bw
99

10-
#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_sym)]
10+
#![feature(no_core, lang_items, rustc_attrs, repr_simd)]
1111
#![crate_type = "rlib"]
1212
#![no_core]
1313
#![allow(asm_sub_register, non_camel_case_types)]

src/test/ui/abi/abi-sysv64-register-usage.rs

+18-8
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,30 @@
66
// ignore-arm
77
// ignore-aarch64
88
// needs-asm-support
9-
#![feature(asm_sym)]
109

1110
#[cfg(target_arch = "x86_64")]
12-
pub extern "sysv64" fn all_the_registers(rdi: i64, rsi: i64, rdx: i64,
13-
rcx: i64, r8 : i64, r9 : i64,
14-
xmm0: f32, xmm1: f32, xmm2: f32,
15-
xmm3: f32, xmm4: f32, xmm5: f32,
16-
xmm6: f32, xmm7: f32) -> i64 {
11+
pub extern "sysv64" fn all_the_registers(
12+
rdi: i64,
13+
rsi: i64,
14+
rdx: i64,
15+
rcx: i64,
16+
r8: i64,
17+
r9: i64,
18+
xmm0: f32,
19+
xmm1: f32,
20+
xmm2: f32,
21+
xmm3: f32,
22+
xmm4: f32,
23+
xmm5: f32,
24+
xmm6: f32,
25+
xmm7: f32,
26+
) -> i64 {
1727
assert_eq!(rdi, 1);
1828
assert_eq!(rsi, 2);
1929
assert_eq!(rdx, 3);
2030
assert_eq!(rcx, 4);
21-
assert_eq!(r8, 5);
22-
assert_eq!(r9, 6);
31+
assert_eq!(r8, 5);
32+
assert_eq!(r9, 6);
2333
assert_eq!(xmm0, 1.0f32);
2434
assert_eq!(xmm1, 2.0f32);
2535
assert_eq!(xmm2, 4.0f32);

src/test/ui/asm/aarch64/bad-reg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// only-aarch64
22
// compile-flags: -C target-feature=+neon
33

4-
#![feature(asm_const, asm_sym)]
4+
#![feature(asm_const)]
55

66
use std::arch::asm;
77

src/test/ui/asm/aarch64/may_unwind.rs

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

5-
#![feature(asm_sym, asm_unwind)]
5+
#![feature(asm_unwind)]
66

77
use std::arch::asm;
88
use std::panic::{catch_unwind, resume_unwind, AssertUnwindSafe};

src/test/ui/asm/aarch64/sym.rs

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

6-
#![feature(thread_local, asm_sym)]
6+
#![feature(thread_local)]
77

88
use std::arch::asm;
99

src/test/ui/asm/aarch64/type-check-2-2.rs

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

3-
#![feature(repr_simd, never_type, asm_sym)]
3+
#![feature(repr_simd, never_type)]
44

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

src/test/ui/asm/aarch64/type-check-2.rs

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

3-
#![feature(repr_simd, never_type, asm_sym)]
3+
#![feature(repr_simd, never_type)]
44

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

src/test/ui/asm/generic-const.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// needs-asm-support
22
// build-pass
33

4-
#![feature(asm_const, asm_sym)]
4+
#![feature(asm_const)]
55

66
use std::arch::asm;
77

src/test/ui/asm/naked-functions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// ignore-wasm32
55

66
#![feature(naked_functions)]
7-
#![feature(asm_const, asm_sym, asm_unwind)]
7+
#![feature(asm_const, asm_unwind)]
88
#![crate_type = "lib"]
99

1010
use std::arch::asm;

src/test/ui/asm/type-check-1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// ignore-spirv
44
// ignore-wasm32
55

6-
#![feature(asm_const, asm_sym)]
6+
#![feature(asm_const)]
77

88
use std::arch::{asm, global_asm};
99

src/test/ui/asm/x86_64/bad-reg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// only-x86_64
22
// compile-flags: -C target-feature=+avx2
33

4-
#![feature(asm_const, asm_sym)]
4+
#![feature(asm_const)]
55

66
use std::arch::asm;
77

src/test/ui/asm/x86_64/issue-96797.rs

-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
// regression test for #96797
99

10-
#![feature(asm_sym)]
11-
1210
use std::arch::global_asm;
1311

1412
#[no_mangle]

src/test/ui/asm/x86_64/may_unwind.rs

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

6-
#![feature(asm_sym, asm_unwind)]
6+
#![feature(asm_unwind)]
77

88
use std::arch::asm;
99
use std::panic::{catch_unwind, resume_unwind, AssertUnwindSafe};

src/test/ui/asm/x86_64/multiple-clobber-abi.rs

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
// Checks that multiple clobber_abi options can be used
66

7-
#![feature(asm_sym)]
8-
97
use std::arch::asm;
108

119
extern "sysv64" fn foo(x: i32) -> i32 {

src/test/ui/asm/x86_64/sym.rs

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

6-
#![feature(thread_local, asm_sym)]
6+
#![feature(thread_local)]
77

88
use std::arch::asm;
99

src/test/ui/asm/x86_64/type-check-2.rs

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

3-
#![feature(repr_simd, never_type, asm_sym)]
3+
#![feature(repr_simd, never_type)]
44

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

src/test/ui/asm/x86_64/type-check-4.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
// only-x86_64
22
// compile-flags: -C target-feature=+avx512f
33

4-
#![feature(asm_const, asm_sym)]
4+
#![feature(asm_const)]
55

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

88
use std::arch::x86_64::{_mm256_setzero_ps, _mm_setzero_ps};
99

10-
fn main() {
11-
}
10+
fn main() {}
1211

1312
// Constants must be... constant
1413

0 commit comments

Comments
 (0)