Skip to content

Commit 0007924

Browse files
authored
Rollup merge of rust-lang#72825 - Amanieu:asm-warning, r=davidtwco
Clarify errors and warnings about the transition to the new asm! Hopefully addresses the concerns from rust-lang#71007 (comment).
2 parents f1732f6 + d490205 commit 0007924

File tree

9 files changed

+21
-12
lines changed

9 files changed

+21
-12
lines changed

src/libcore/macros/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,7 @@ pub(crate) mod builtin {
13151315
#[unstable(
13161316
feature = "llvm_asm",
13171317
issue = "70173",
1318-
reason = "LLVM-style inline assembly will never be stabilized, prefer using asm! instead"
1318+
reason = "prefer using the new asm! syntax instead"
13191319
)]
13201320
#[rustc_builtin_macro]
13211321
#[macro_export]

src/librustc_builtin_macros/asm.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ fn parse_args<'a>(
3333

3434
// Detect use of the legacy llvm_asm! syntax (which used to be called asm!)
3535
if p.look_ahead(1, |t| *t == token::Colon || *t == token::ModSep) {
36-
let mut err = ecx.struct_span_err(sp, "legacy asm! syntax is no longer supported");
36+
let mut err =
37+
ecx.struct_span_err(sp, "the legacy LLVM-style asm! syntax is no longer supported");
38+
err.note("consider migrating to the new asm! syntax specified in RFC 2873");
39+
err.note("alternatively, switch to llvm_asm! to keep your code working as it is");
3740

3841
// Find the span of the "asm!" so that we can offer an automatic suggestion
3942
let asm_span = sp.from_inner(InnerSpan::new(0, 4));

src/test/ui/asm/rustfix-asm.fixed

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ fn main() {
88
let x = 1;
99
let y: i32;
1010
llvm_asm!("" :: "r" (x));
11-
//~^ ERROR legacy asm! syntax is no longer supported
11+
//~^ ERROR the legacy LLVM-style asm! syntax is no longer supported
1212
llvm_asm!("" : "=r" (y));
13-
//~^ ERROR legacy asm! syntax is no longer supported
13+
//~^ ERROR the legacy LLVM-style asm! syntax is no longer supported
1414
let _ = y;
1515
}
1616
}

src/test/ui/asm/rustfix-asm.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ fn main() {
88
let x = 1;
99
let y: i32;
1010
asm!("" :: "r" (x));
11-
//~^ ERROR legacy asm! syntax is no longer supported
11+
//~^ ERROR the legacy LLVM-style asm! syntax is no longer supported
1212
asm!("" : "=r" (y));
13-
//~^ ERROR legacy asm! syntax is no longer supported
13+
//~^ ERROR the legacy LLVM-style asm! syntax is no longer supported
1414
let _ = y;
1515
}
1616
}

src/test/ui/asm/rustfix-asm.stderr

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
1-
error: legacy asm! syntax is no longer supported
1+
error: the legacy LLVM-style asm! syntax is no longer supported
22
--> $DIR/rustfix-asm.rs:10:9
33
|
44
LL | asm!("" :: "r" (x));
55
| ----^^^^^^^^^^^^^^^^
66
| |
77
| help: replace with: `llvm_asm!`
8+
|
9+
= note: consider migrating to the new asm! syntax specified in RFC 2873
10+
= note: alternatively, switch to llvm_asm! to keep your code working as it is
811

9-
error: legacy asm! syntax is no longer supported
12+
error: the legacy LLVM-style asm! syntax is no longer supported
1013
--> $DIR/rustfix-asm.rs:12:9
1114
|
1215
LL | asm!("" : "=r" (y));
1316
| ----^^^^^^^^^^^^^^^^
1417
| |
1518
| help: replace with: `llvm_asm!`
19+
|
20+
= note: consider migrating to the new asm! syntax specified in RFC 2873
21+
= note: alternatively, switch to llvm_asm! to keep your code working as it is
1622

1723
error: aborting due to 2 previous errors
1824

src/test/ui/feature-gates/feature-gate-asm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ fn main() {
55
asm!("");
66
//~^ ERROR inline assembly is not stable enough
77
llvm_asm!("");
8-
//~^ ERROR LLVM-style inline assembly will never be stabilized
8+
//~^ ERROR prefer using the new asm! syntax instead
99
}
1010
}

src/test/ui/feature-gates/feature-gate-asm.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | asm!("");
77
= note: see issue #72016 <https://github.com/rust-lang/rust/issues/72016> for more information
88
= help: add `#![feature(asm)]` to the crate attributes to enable
99

10-
error[E0658]: use of unstable library feature 'llvm_asm': LLVM-style inline assembly will never be stabilized, prefer using asm! instead
10+
error[E0658]: use of unstable library feature 'llvm_asm': prefer using the new asm! syntax instead
1111
--> $DIR/feature-gate-asm.rs:7:9
1212
|
1313
LL | llvm_asm!("");

src/test/ui/feature-gates/feature-gate-asm2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ fn main() {
55
println!("{:?}", asm!(""));
66
//~^ ERROR inline assembly is not stable enough
77
println!("{:?}", llvm_asm!(""));
8-
//~^ ERROR LLVM-style inline assembly will never be stabilized
8+
//~^ ERROR prefer using the new asm! syntax instead
99
}
1010
}

src/test/ui/feature-gates/feature-gate-asm2.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | println!("{:?}", asm!(""));
77
= note: see issue #72016 <https://github.com/rust-lang/rust/issues/72016> for more information
88
= help: add `#![feature(asm)]` to the crate attributes to enable
99

10-
error[E0658]: use of unstable library feature 'llvm_asm': LLVM-style inline assembly will never be stabilized, prefer using asm! instead
10+
error[E0658]: use of unstable library feature 'llvm_asm': prefer using the new asm! syntax instead
1111
--> $DIR/feature-gate-asm2.rs:7:26
1212
|
1313
LL | println!("{:?}", llvm_asm!(""));

0 commit comments

Comments
 (0)