diff --git a/src/libcore/macros/mod.rs b/src/libcore/macros/mod.rs index 79f2bdf752d74..73404a73e3d00 100644 --- a/src/libcore/macros/mod.rs +++ b/src/libcore/macros/mod.rs @@ -1316,9 +1316,13 @@ pub(crate) mod builtin { issue = "70173", reason = "inline assembly is not stable enough for use and is subject to change" )] - #[rustc_deprecated( - since = "1.44.0", - reason = "the syntax of asm! will change soon, use llvm_asm! to avoid breakage" + #[cfg_attr( + not(bootstrap), + rustc_deprecated( + since = "1.44.0", + reason = "the syntax of asm! will change soon, use llvm_asm! to avoid breakage", + suggestion = "llvm_asm", + ) )] #[rustc_builtin_macro] #[macro_export] diff --git a/src/libcore/prelude/v1.rs b/src/libcore/prelude/v1.rs index 9b4ed4e820512..6a51d39ab9d4e 100644 --- a/src/libcore/prelude/v1.rs +++ b/src/libcore/prelude/v1.rs @@ -54,6 +54,7 @@ pub use crate::fmt::macros::Debug; pub use crate::hash::macros::Hash; #[stable(feature = "builtin_macro_prelude", since = "1.38.0")] +#[allow(deprecated)] #[doc(no_inline)] pub use crate::{ asm, assert, cfg, column, compile_error, concat, concat_idents, env, file, format_args, diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index a9a519f0a3a71..dfb5177bf6725 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -523,6 +523,7 @@ pub use core::{ // Re-export built-in macros defined through libcore. #[stable(feature = "builtin_macro_prelude", since = "1.38.0")] +#[allow(deprecated)] pub use core::{ asm, assert, cfg, column, compile_error, concat, concat_idents, env, file, format_args, format_args_nl, global_asm, include, include_bytes, include_str, line, llvm_asm, log_syntax, diff --git a/src/libstd/prelude/v1.rs b/src/libstd/prelude/v1.rs index 03686d789d721..92e3ea8485036 100644 --- a/src/libstd/prelude/v1.rs +++ b/src/libstd/prelude/v1.rs @@ -36,6 +36,7 @@ pub use crate::result::Result::{self, Err, Ok}; // Re-exported built-in macros #[stable(feature = "builtin_macro_prelude", since = "1.38.0")] +#[allow(deprecated)] #[doc(no_inline)] pub use core::prelude::v1::{ asm, assert, cfg, column, compile_error, concat, concat_idents, env, file, format_args, diff --git a/src/test/ui/feature-gates/feature-gate-asm.rs b/src/test/ui/feature-gates/feature-gate-asm.rs index 7eeeb4bc4e243..70f5845550d17 100644 --- a/src/test/ui/feature-gates/feature-gate-asm.rs +++ b/src/test/ui/feature-gates/feature-gate-asm.rs @@ -3,6 +3,7 @@ fn main() { unsafe { asm!(""); //~ ERROR inline assembly is not stable enough + //~^ WARN use of deprecated item 'asm' llvm_asm!(""); //~ ERROR inline assembly is not stable enough } } diff --git a/src/test/ui/feature-gates/feature-gate-asm.stderr b/src/test/ui/feature-gates/feature-gate-asm.stderr index 1f9eaa5632e4a..9d4d7b53955b5 100644 --- a/src/test/ui/feature-gates/feature-gate-asm.stderr +++ b/src/test/ui/feature-gates/feature-gate-asm.stderr @@ -8,7 +8,7 @@ LL | asm!(""); = help: add `#![feature(asm)]` to the crate attributes to enable error[E0658]: use of unstable library feature 'llvm_asm': inline assembly is not stable enough for use and is subject to change - --> $DIR/feature-gate-asm.rs:6:9 + --> $DIR/feature-gate-asm.rs:7:9 | LL | llvm_asm!(""); | ^^^^^^^^ @@ -16,6 +16,14 @@ LL | llvm_asm!(""); = note: see issue #70173 for more information = help: add `#![feature(llvm_asm)]` to the crate attributes to enable -error: aborting due to 2 previous errors +warning: use of deprecated item 'asm': the syntax of asm! will change soon, use llvm_asm! to avoid breakage + --> $DIR/feature-gate-asm.rs:5:9 + | +LL | asm!(""); + | ^^^ help: replace the use of the deprecated item: `llvm_asm` + | + = note: `#[warn(deprecated)]` on by default + +error: aborting due to 2 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-asm2.rs b/src/test/ui/feature-gates/feature-gate-asm2.rs index 666a4894f6275..e3e86592a480a 100644 --- a/src/test/ui/feature-gates/feature-gate-asm2.rs +++ b/src/test/ui/feature-gates/feature-gate-asm2.rs @@ -3,6 +3,7 @@ fn main() { unsafe { println!("{:?}", asm!("")); //~ ERROR inline assembly is not stable + //~^ WARN use of deprecated item 'asm' println!("{:?}", llvm_asm!("")); //~ ERROR inline assembly is not stable } } diff --git a/src/test/ui/feature-gates/feature-gate-asm2.stderr b/src/test/ui/feature-gates/feature-gate-asm2.stderr index 17ba66e9842fa..a3c8116d6b166 100644 --- a/src/test/ui/feature-gates/feature-gate-asm2.stderr +++ b/src/test/ui/feature-gates/feature-gate-asm2.stderr @@ -8,7 +8,7 @@ LL | println!("{:?}", asm!("")); = help: add `#![feature(asm)]` to the crate attributes to enable error[E0658]: use of unstable library feature 'llvm_asm': inline assembly is not stable enough for use and is subject to change - --> $DIR/feature-gate-asm2.rs:6:26 + --> $DIR/feature-gate-asm2.rs:7:26 | LL | println!("{:?}", llvm_asm!("")); | ^^^^^^^^ @@ -16,6 +16,14 @@ LL | println!("{:?}", llvm_asm!("")); = note: see issue #70173 for more information = help: add `#![feature(llvm_asm)]` to the crate attributes to enable -error: aborting due to 2 previous errors +warning: use of deprecated item 'asm': the syntax of asm! will change soon, use llvm_asm! to avoid breakage + --> $DIR/feature-gate-asm2.rs:5:26 + | +LL | println!("{:?}", asm!("")); + | ^^^ help: replace the use of the deprecated item: `llvm_asm` + | + = note: `#[warn(deprecated)]` on by default + +error: aborting due to 2 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0658`.