diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2020-06-02 13:07:17 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-02 13:07:17 +0900 |
| commit | 0007924cd096a26c67bd48bf167adfc59ddf45c0 (patch) | |
| tree | 7353327d01f1a814d69e9010972031c92275d768 /src | |
| parent | f1732f66ff36ae2e650b01182d3071bc3df96e51 (diff) | |
| parent | d49020573c34611b748b2d7737563f594f5c0215 (diff) | |
| download | rust-0007924cd096a26c67bd48bf167adfc59ddf45c0.tar.gz rust-0007924cd096a26c67bd48bf167adfc59ddf45c0.zip | |
Rollup merge of #72825 - Amanieu:asm-warning, r=davidtwco
Clarify errors and warnings about the transition to the new asm! Hopefully addresses the concerns from https://github.com/rust-lang/rust/pull/71007#issuecomment-636412905.
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcore/macros/mod.rs | 2 | ||||
| -rw-r--r-- | src/librustc_builtin_macros/asm.rs | 5 | ||||
| -rw-r--r-- | src/test/ui/asm/rustfix-asm.fixed | 4 | ||||
| -rw-r--r-- | src/test/ui/asm/rustfix-asm.rs | 4 | ||||
| -rw-r--r-- | src/test/ui/asm/rustfix-asm.stderr | 10 | ||||
| -rw-r--r-- | src/test/ui/feature-gates/feature-gate-asm.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/feature-gates/feature-gate-asm.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/feature-gates/feature-gate-asm2.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/feature-gates/feature-gate-asm2.stderr | 2 |
9 files changed, 21 insertions, 12 deletions
diff --git a/src/libcore/macros/mod.rs b/src/libcore/macros/mod.rs index 625ceb0953b..3cfdde60135 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 19fae635572..fad638f6f28 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 c9271059810..01d8fd34b68 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 a108595ca1b..e25895b7230 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 28675b51d15..334499c6fd8 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 4eb72031d51..753e924f004 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 a71643e0d33..d770565b099 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 <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!(""); diff --git a/src/test/ui/feature-gates/feature-gate-asm2.rs b/src/test/ui/feature-gates/feature-gate-asm2.rs index 8bd7226aca7..e9349acb643 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 a8022cb72e0..85278c98d77 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 <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!("")); |
