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.
This commit is contained in:
commit
0007924cd0
9 changed files with 21 additions and 12 deletions
|
@ -1315,7 +1315,7 @@ pub(crate) mod builtin {
|
||||||
#[unstable(
|
#[unstable(
|
||||||
feature = "llvm_asm",
|
feature = "llvm_asm",
|
||||||
issue = "70173",
|
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]
|
#[rustc_builtin_macro]
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
|
|
|
@ -33,7 +33,10 @@ fn parse_args<'a>(
|
||||||
|
|
||||||
// Detect use of the legacy llvm_asm! syntax (which used to be called asm!)
|
// 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) {
|
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
|
// Find the span of the "asm!" so that we can offer an automatic suggestion
|
||||||
let asm_span = sp.from_inner(InnerSpan::new(0, 4));
|
let asm_span = sp.from_inner(InnerSpan::new(0, 4));
|
||||||
|
|
|
@ -8,9 +8,9 @@ fn main() {
|
||||||
let x = 1;
|
let x = 1;
|
||||||
let y: i32;
|
let y: i32;
|
||||||
llvm_asm!("" :: "r" (x));
|
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));
|
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;
|
let _ = y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,9 @@ fn main() {
|
||||||
let x = 1;
|
let x = 1;
|
||||||
let y: i32;
|
let y: i32;
|
||||||
asm!("" :: "r" (x));
|
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));
|
asm!("" : "=r" (y));
|
||||||
//~^ ERROR legacy asm! syntax is no longer supported
|
//~^ ERROR the legacy LLVM-style asm! syntax is no longer supported
|
||||||
let _ = y;
|
let _ = y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
--> $DIR/rustfix-asm.rs:10:9
|
||||||
|
|
|
|
||||||
LL | asm!("" :: "r" (x));
|
LL | asm!("" :: "r" (x));
|
||||||
| ----^^^^^^^^^^^^^^^^
|
| ----^^^^^^^^^^^^^^^^
|
||||||
| |
|
| |
|
||||||
| help: replace with: `llvm_asm!`
|
| 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
|
--> $DIR/rustfix-asm.rs:12:9
|
||||||
|
|
|
|
||||||
LL | asm!("" : "=r" (y));
|
LL | asm!("" : "=r" (y));
|
||||||
| ----^^^^^^^^^^^^^^^^
|
| ----^^^^^^^^^^^^^^^^
|
||||||
| |
|
| |
|
||||||
| help: replace with: `llvm_asm!`
|
| 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
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,6 @@ fn main() {
|
||||||
asm!("");
|
asm!("");
|
||||||
//~^ ERROR inline assembly is not stable enough
|
//~^ ERROR inline assembly is not stable enough
|
||||||
llvm_asm!("");
|
llvm_asm!("");
|
||||||
//~^ ERROR LLVM-style inline assembly will never be stabilized
|
//~^ ERROR prefer using the new asm! syntax instead
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ LL | asm!("");
|
||||||
= note: see issue #72016 <https://github.com/rust-lang/rust/issues/72016> for more information
|
= 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
|
= 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
|
--> $DIR/feature-gate-asm.rs:7:9
|
||||||
|
|
|
|
||||||
LL | llvm_asm!("");
|
LL | llvm_asm!("");
|
||||||
|
|
|
@ -5,6 +5,6 @@ fn main() {
|
||||||
println!("{:?}", asm!(""));
|
println!("{:?}", asm!(""));
|
||||||
//~^ ERROR inline assembly is not stable enough
|
//~^ ERROR inline assembly is not stable enough
|
||||||
println!("{:?}", llvm_asm!(""));
|
println!("{:?}", llvm_asm!(""));
|
||||||
//~^ ERROR LLVM-style inline assembly will never be stabilized
|
//~^ ERROR prefer using the new asm! syntax instead
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ LL | println!("{:?}", asm!(""));
|
||||||
= note: see issue #72016 <https://github.com/rust-lang/rust/issues/72016> for more information
|
= 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
|
= 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
|
--> $DIR/feature-gate-asm2.rs:7:26
|
||||||
|
|
|
|
||||||
LL | println!("{:?}", llvm_asm!(""));
|
LL | println!("{:?}", llvm_asm!(""));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue