Skip to content

Commit 10ed30a

Browse files
authored
Unrolled build for rust-lang#128570
Rollup merge of rust-lang#128570 - folkertdev:stabilize-asm-const, r=Amanieu Stabilize `asm_const` tracking issue: rust-lang#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 0f442e2 + 8419c09 commit 10ed30a

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

-2
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

+3-14
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

+6-9
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

+2
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

-2
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

+1-1
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

-11
This file was deleted.

tests/assembly/asm/global_asm.rs

-1
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

+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_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

-2
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() {

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

+22-22
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error: invalid register class `foo`: unknown register class
2-
--> $DIR/bad-reg.rs:14:20
2+
--> $DIR/bad-reg.rs:12:20
33
|
44
LL | asm!("{}", in(foo) foo);
55
| ^^^^^^^^^^^
66

77
error: invalid register `foo`: unknown register
8-
--> $DIR/bad-reg.rs:16:18
8+
--> $DIR/bad-reg.rs:14:18
99
|
1010
LL | asm!("", in("foo") foo);
1111
| ^^^^^^^^^^^^^
1212

1313
error: invalid asm template modifier for this register class
14-
--> $DIR/bad-reg.rs:18:15
14+
--> $DIR/bad-reg.rs:16:15
1515
|
1616
LL | asm!("{:z}", in(reg) foo);
1717
| ^^^^ ----------- argument
@@ -21,7 +21,7 @@ LL | asm!("{:z}", in(reg) foo);
2121
= note: the `reg` register class supports the following template modifiers: `w`, `x`
2222

2323
error: invalid asm template modifier for this register class
24-
--> $DIR/bad-reg.rs:20:15
24+
--> $DIR/bad-reg.rs:18:15
2525
|
2626
LL | asm!("{:r}", in(vreg) foo);
2727
| ^^^^ ------------ argument
@@ -31,7 +31,7 @@ LL | asm!("{:r}", in(vreg) foo);
3131
= note: the `vreg` register class supports the following template modifiers: `b`, `h`, `s`, `d`, `q`, `v`
3232

3333
error: invalid asm template modifier for this register class
34-
--> $DIR/bad-reg.rs:22:15
34+
--> $DIR/bad-reg.rs:20:15
3535
|
3636
LL | asm!("{:r}", in(vreg_low16) foo);
3737
| ^^^^ ------------------ argument
@@ -41,117 +41,117 @@ LL | asm!("{:r}", in(vreg_low16) foo);
4141
= note: the `vreg_low16` register class supports the following template modifiers: `b`, `h`, `s`, `d`, `q`, `v`
4242

4343
error: asm template modifiers are not allowed for `const` arguments
44-
--> $DIR/bad-reg.rs:24:15
44+
--> $DIR/bad-reg.rs:22:15
4545
|
4646
LL | asm!("{:a}", const 0);
4747
| ^^^^ ------- argument
4848
| |
4949
| template modifier
5050

5151
error: asm template modifiers are not allowed for `sym` arguments
52-
--> $DIR/bad-reg.rs:26:15
52+
--> $DIR/bad-reg.rs:24:15
5353
|
5454
LL | asm!("{:a}", sym main);
5555
| ^^^^ -------- argument
5656
| |
5757
| template modifier
5858

5959
error: invalid register `x29`: the frame pointer cannot be used as an operand for inline asm
60-
--> $DIR/bad-reg.rs:28:18
60+
--> $DIR/bad-reg.rs:26:18
6161
|
6262
LL | asm!("", in("x29") foo);
6363
| ^^^^^^^^^^^^^
6464

6565
error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm
66-
--> $DIR/bad-reg.rs:30:18
66+
--> $DIR/bad-reg.rs:28:18
6767
|
6868
LL | asm!("", in("sp") foo);
6969
| ^^^^^^^^^^^^
7070

7171
error: invalid register `xzr`: the zero register cannot be used as an operand for inline asm
72-
--> $DIR/bad-reg.rs:32:18
72+
--> $DIR/bad-reg.rs:30:18
7373
|
7474
LL | asm!("", in("xzr") foo);
7575
| ^^^^^^^^^^^^^
7676

7777
error: invalid register `x19`: x19 is used internally by LLVM and cannot be used as an operand for inline asm
78-
--> $DIR/bad-reg.rs:34:18
78+
--> $DIR/bad-reg.rs:32:18
7979
|
8080
LL | asm!("", in("x19") foo);
8181
| ^^^^^^^^^^^^^
8282

8383
error: register class `preg` can only be used as a clobber, not as an input or output
84-
--> $DIR/bad-reg.rs:37:18
84+
--> $DIR/bad-reg.rs:35:18
8585
|
8686
LL | asm!("", in("p0") foo);
8787
| ^^^^^^^^^^^^
8888

8989
error: register class `preg` can only be used as a clobber, not as an input or output
90-
--> $DIR/bad-reg.rs:41:20
90+
--> $DIR/bad-reg.rs:39:20
9191
|
9292
LL | asm!("{}", in(preg) foo);
9393
| ^^^^^^^^^^^^
9494

9595
error: register class `preg` can only be used as a clobber, not as an input or output
96-
--> $DIR/bad-reg.rs:44:20
96+
--> $DIR/bad-reg.rs:42:20
9797
|
9898
LL | asm!("{}", out(preg) _);
9999
| ^^^^^^^^^^^
100100

101101
error: register `w0` conflicts with register `x0`
102-
--> $DIR/bad-reg.rs:50:32
102+
--> $DIR/bad-reg.rs:48:32
103103
|
104104
LL | asm!("", in("x0") foo, in("w0") bar);
105105
| ------------ ^^^^^^^^^^^^ register `w0`
106106
| |
107107
| register `x0`
108108

109109
error: register `x0` conflicts with register `x0`
110-
--> $DIR/bad-reg.rs:52:32
110+
--> $DIR/bad-reg.rs:50:32
111111
|
112112
LL | asm!("", in("x0") foo, out("x0") bar);
113113
| ------------ ^^^^^^^^^^^^^ register `x0`
114114
| |
115115
| register `x0`
116116
|
117117
help: use `lateout` instead of `out` to avoid conflict
118-
--> $DIR/bad-reg.rs:52:18
118+
--> $DIR/bad-reg.rs:50:18
119119
|
120120
LL | asm!("", in("x0") foo, out("x0") bar);
121121
| ^^^^^^^^^^^^
122122

123123
error: register `q0` conflicts with register `v0`
124-
--> $DIR/bad-reg.rs:55:32
124+
--> $DIR/bad-reg.rs:53:32
125125
|
126126
LL | asm!("", in("v0") foo, in("q0") bar);
127127
| ------------ ^^^^^^^^^^^^ register `q0`
128128
| |
129129
| register `v0`
130130

131131
error: register `q0` conflicts with register `v0`
132-
--> $DIR/bad-reg.rs:57:32
132+
--> $DIR/bad-reg.rs:55:32
133133
|
134134
LL | asm!("", in("v0") foo, out("q0") bar);
135135
| ------------ ^^^^^^^^^^^^^ register `q0`
136136
| |
137137
| register `v0`
138138
|
139139
help: use `lateout` instead of `out` to avoid conflict
140-
--> $DIR/bad-reg.rs:57:18
140+
--> $DIR/bad-reg.rs:55:18
141141
|
142142
LL | asm!("", in("v0") foo, out("q0") bar);
143143
| ^^^^^^^^^^^^
144144

145145
error: type `i32` cannot be used with this register class
146-
--> $DIR/bad-reg.rs:37:27
146+
--> $DIR/bad-reg.rs:35:27
147147
|
148148
LL | asm!("", in("p0") foo);
149149
| ^^^
150150
|
151151
= note: register class `preg` supports these types:
152152

153153
error: type `i32` cannot be used with this register class
154-
--> $DIR/bad-reg.rs:41:29
154+
--> $DIR/bad-reg.rs:39:29
155155
|
156156
LL | asm!("{}", in(preg) foo);
157157
| ^^^

tests/ui/asm/aarch64/const.rs

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

5-
#![feature(asm_const)]
6-
75
use std::arch::{asm, global_asm};
86

97
fn const_generic<const X: usize>() -> usize {

tests/ui/asm/aarch64/parse-error.rs

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

3-
#![feature(asm_const)]
4-
53
use std::arch::{asm, global_asm};
64

75
fn main() {

0 commit comments

Comments
 (0)