Clarify errors and warnings about the transition to the new asm!

This commit is contained in:
Amanieu d'Antras 2020-05-31 18:11:03 +01:00
parent 4b1f86adbe
commit d49020573c
9 changed files with 21 additions and 12 deletions

View File

@ -1315,7 +1315,7 @@ pub(crate) mod builtin {
#[unstable(
feature = "llvm_asm",
issue = "70173",
reason = "LLVM-style inline assembly will never be stabilized, prefer using asm! instead"
reason = "prefer using the new asm! syntax instead"
)]
#[rustc_builtin_macro]
#[macro_export]

View File

@ -33,7 +33,10 @@ fn parse_args<'a>(
// Detect use of the legacy llvm_asm! syntax (which used to be called asm!)
if p.look_ahead(1, |t| *t == token::Colon || *t == token::ModSep) {
let mut err = ecx.struct_span_err(sp, "legacy asm! syntax is no longer supported");
let mut err =
ecx.struct_span_err(sp, "the legacy LLVM-style asm! syntax is no longer supported");
err.note("consider migrating to the new asm! syntax specified in RFC 2873");
err.note("alternatively, switch to llvm_asm! to keep your code working as it is");
// Find the span of the "asm!" so that we can offer an automatic suggestion
let asm_span = sp.from_inner(InnerSpan::new(0, 4));

View File

@ -8,9 +8,9 @@ fn main() {
let x = 1;
let y: i32;
llvm_asm!("" :: "r" (x));
//~^ ERROR legacy asm! syntax is no longer supported
//~^ ERROR the legacy LLVM-style asm! syntax is no longer supported
llvm_asm!("" : "=r" (y));
//~^ ERROR legacy asm! syntax is no longer supported
//~^ ERROR the legacy LLVM-style asm! syntax is no longer supported
let _ = y;
}
}

View File

@ -8,9 +8,9 @@ fn main() {
let x = 1;
let y: i32;
asm!("" :: "r" (x));
//~^ ERROR legacy asm! syntax is no longer supported
//~^ ERROR the legacy LLVM-style asm! syntax is no longer supported
asm!("" : "=r" (y));
//~^ ERROR legacy asm! syntax is no longer supported
//~^ ERROR the legacy LLVM-style asm! syntax is no longer supported
let _ = y;
}
}

View File

@ -1,18 +1,24 @@
error: legacy asm! syntax is no longer supported
error: the legacy LLVM-style asm! syntax is no longer supported
--> $DIR/rustfix-asm.rs:10:9
|
LL | asm!("" :: "r" (x));
| ----^^^^^^^^^^^^^^^^
| |
| help: replace with: `llvm_asm!`
|
= note: consider migrating to the new asm! syntax specified in RFC 2873
= note: alternatively, switch to llvm_asm! to keep your code working as it is
error: legacy asm! syntax is no longer supported
error: the legacy LLVM-style asm! syntax is no longer supported
--> $DIR/rustfix-asm.rs:12:9
|
LL | asm!("" : "=r" (y));
| ----^^^^^^^^^^^^^^^^
| |
| help: replace with: `llvm_asm!`
|
= note: consider migrating to the new asm! syntax specified in RFC 2873
= note: alternatively, switch to llvm_asm! to keep your code working as it is
error: aborting due to 2 previous errors

View File

@ -5,6 +5,6 @@ fn main() {
asm!("");
//~^ ERROR inline assembly is not stable enough
llvm_asm!("");
//~^ ERROR LLVM-style inline assembly will never be stabilized
//~^ ERROR prefer using the new asm! syntax instead
}
}

View File

@ -7,7 +7,7 @@ LL | asm!("");
= note: see issue #72016 <https://github.com/rust-lang/rust/issues/72016> for more information
= help: add `#![feature(asm)]` to the crate attributes to enable
error[E0658]: use of unstable library feature 'llvm_asm': LLVM-style inline assembly will never be stabilized, prefer using asm! instead
error[E0658]: use of unstable library feature 'llvm_asm': prefer using the new asm! syntax instead
--> $DIR/feature-gate-asm.rs:7:9
|
LL | llvm_asm!("");

View File

@ -5,6 +5,6 @@ fn main() {
println!("{:?}", asm!(""));
//~^ ERROR inline assembly is not stable enough
println!("{:?}", llvm_asm!(""));
//~^ ERROR LLVM-style inline assembly will never be stabilized
//~^ ERROR prefer using the new asm! syntax instead
}
}

View File

@ -7,7 +7,7 @@ LL | println!("{:?}", asm!(""));
= note: see issue #72016 <https://github.com/rust-lang/rust/issues/72016> for more information
= help: add `#![feature(asm)]` to the crate attributes to enable
error[E0658]: use of unstable library feature 'llvm_asm': LLVM-style inline assembly will never be stabilized, prefer using asm! instead
error[E0658]: use of unstable library feature 'llvm_asm': prefer using the new asm! syntax instead
--> $DIR/feature-gate-asm2.rs:7:26
|
LL | println!("{:?}", llvm_asm!(""));