diff --git a/src/libcore/macros/mod.rs b/src/libcore/macros/mod.rs index 625ceb0953b0a..3cfdde60135b7 100644 --- a/src/libcore/macros/mod.rs +++ b/src/libcore/macros/mod.rs @@ -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] diff --git a/src/librustc_builtin_macros/asm.rs b/src/librustc_builtin_macros/asm.rs index 19fae63557289..fad638f6f2819 100644 --- a/src/librustc_builtin_macros/asm.rs +++ b/src/librustc_builtin_macros/asm.rs @@ -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)); diff --git a/src/test/ui/asm/rustfix-asm.fixed b/src/test/ui/asm/rustfix-asm.fixed index c9271059810c7..01d8fd34b68a8 100644 --- a/src/test/ui/asm/rustfix-asm.fixed +++ b/src/test/ui/asm/rustfix-asm.fixed @@ -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; } } diff --git a/src/test/ui/asm/rustfix-asm.rs b/src/test/ui/asm/rustfix-asm.rs index a108595ca1b66..e25895b723049 100644 --- a/src/test/ui/asm/rustfix-asm.rs +++ b/src/test/ui/asm/rustfix-asm.rs @@ -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; } } diff --git a/src/test/ui/asm/rustfix-asm.stderr b/src/test/ui/asm/rustfix-asm.stderr index 28675b51d15fb..334499c6fd897 100644 --- a/src/test/ui/asm/rustfix-asm.stderr +++ b/src/test/ui/asm/rustfix-asm.stderr @@ -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 diff --git a/src/test/ui/feature-gates/feature-gate-asm.rs b/src/test/ui/feature-gates/feature-gate-asm.rs index 4eb72031d51b1..753e924f00495 100644 --- a/src/test/ui/feature-gates/feature-gate-asm.rs +++ b/src/test/ui/feature-gates/feature-gate-asm.rs @@ -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 } } diff --git a/src/test/ui/feature-gates/feature-gate-asm.stderr b/src/test/ui/feature-gates/feature-gate-asm.stderr index a71643e0d33a3..d770565b0991c 100644 --- a/src/test/ui/feature-gates/feature-gate-asm.stderr +++ b/src/test/ui/feature-gates/feature-gate-asm.stderr @@ -7,7 +7,7 @@ LL | asm!(""); = note: see issue #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!(""); diff --git a/src/test/ui/feature-gates/feature-gate-asm2.rs b/src/test/ui/feature-gates/feature-gate-asm2.rs index 8bd7226aca730..e9349acb64394 100644 --- a/src/test/ui/feature-gates/feature-gate-asm2.rs +++ b/src/test/ui/feature-gates/feature-gate-asm2.rs @@ -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 } } diff --git a/src/test/ui/feature-gates/feature-gate-asm2.stderr b/src/test/ui/feature-gates/feature-gate-asm2.stderr index a8022cb72e0e3..85278c98d77e9 100644 --- a/src/test/ui/feature-gates/feature-gate-asm2.stderr +++ b/src/test/ui/feature-gates/feature-gate-asm2.stderr @@ -7,7 +7,7 @@ LL | println!("{:?}", asm!("")); = note: see issue #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!(""));