Skip to content

Commit 9b2f8db

Browse files
committed
Auto merge of rust-lang#71007 - Amanieu:deprecate_asm, r=Mark-Simulacrum
Deprecate the asm! macro in favor of llvm_asm! Since we will be changing the syntax of `asm!` soon, deprecate it and encourage people to use `llvm_asm!` instead (which preserves the old syntax). This will avoid breakage when `asm!` is changed. RFC: rust-lang/rfcs#2843
2 parents c6b55ee + ce83b49 commit 9b2f8db

File tree

11 files changed

+47
-18
lines changed

11 files changed

+47
-18
lines changed

Cargo.lock

+12-12
Original file line numberDiff line numberDiff line change
@@ -1736,7 +1736,7 @@ checksum = "5b31c9b90731276fdd24d896f31bb10aecf2e5151733364ae81123186643d939"
17361736
dependencies = [
17371737
"jsonrpc-core",
17381738
"log",
1739-
"parking_lot 0.10.0",
1739+
"parking_lot 0.10.2",
17401740
"serde",
17411741
]
17421742

@@ -1855,9 +1855,9 @@ checksum = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83"
18551855

18561856
[[package]]
18571857
name = "lock_api"
1858-
version = "0.3.1"
1858+
version = "0.3.4"
18591859
source = "registry+https://github.com/rust-lang/crates.io-index"
1860-
checksum = "f8912e782533a93a167888781b836336a6ca5da6175c05944c86cf28c31104dc"
1860+
checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75"
18611861
dependencies = [
18621862
"scopeguard",
18631863
]
@@ -2395,12 +2395,12 @@ dependencies = [
23952395

23962396
[[package]]
23972397
name = "parking_lot"
2398-
version = "0.10.0"
2398+
version = "0.10.2"
23992399
source = "registry+https://github.com/rust-lang/crates.io-index"
2400-
checksum = "92e98c49ab0b7ce5b222f2cc9193fc4efe11c6d0bd4f648e374684a6857b1cfc"
2400+
checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e"
24012401
dependencies = [
24022402
"lock_api",
2403-
"parking_lot_core 0.7.0",
2403+
"parking_lot_core 0.7.1",
24042404
]
24052405

24062406
[[package]]
@@ -2420,9 +2420,9 @@ dependencies = [
24202420

24212421
[[package]]
24222422
name = "parking_lot_core"
2423-
version = "0.7.0"
2423+
version = "0.7.1"
24242424
source = "registry+https://github.com/rust-lang/crates.io-index"
2425-
checksum = "7582838484df45743c8434fbff785e8edf260c28748353d44bc0da32e0ceabf1"
2425+
checksum = "0e136c1904604defe99ce5fd71a28d473fa60a12255d511aa78a9ddf11237aeb"
24262426
dependencies = [
24272427
"cfg-if",
24282428
"cloudabi",
@@ -3242,7 +3242,7 @@ dependencies = [
32423242
"libc",
32433243
"log",
32443244
"measureme",
3245-
"parking_lot 0.10.0",
3245+
"parking_lot 0.10.2",
32463246
"rustc-ap-graphviz",
32473247
"rustc-ap-rustc_index",
32483248
"rustc-ap-serialize",
@@ -3691,7 +3691,7 @@ dependencies = [
36913691
"libc",
36923692
"log",
36933693
"measureme",
3694-
"parking_lot 0.10.0",
3694+
"parking_lot 0.10.2",
36953695
"rustc-hash",
36963696
"rustc-rayon",
36973697
"rustc-rayon-core",
@@ -3989,7 +3989,7 @@ dependencies = [
39893989
"jobserver",
39903990
"log",
39913991
"measureme",
3992-
"parking_lot 0.10.0",
3992+
"parking_lot 0.10.2",
39933993
"polonius-engine",
39943994
"rustc-rayon",
39953995
"rustc-rayon-core",
@@ -4138,7 +4138,7 @@ name = "rustc_query_system"
41384138
version = "0.0.0"
41394139
dependencies = [
41404140
"log",
4141-
"parking_lot 0.9.0",
4141+
"parking_lot 0.10.2",
41424142
"rustc-rayon-core",
41434143
"rustc_data_structures",
41444144
"rustc_errors",

src/libcore/macros/mod.rs

+8
Original file line numberDiff line numberDiff line change
@@ -1316,6 +1316,14 @@ pub(crate) mod builtin {
13161316
issue = "70173",
13171317
reason = "inline assembly is not stable enough for use and is subject to change"
13181318
)]
1319+
#[cfg_attr(
1320+
not(bootstrap),
1321+
rustc_deprecated(
1322+
since = "1.44.0",
1323+
reason = "the syntax of asm! will change soon, use llvm_asm! to avoid breakage",
1324+
suggestion = "llvm_asm",
1325+
)
1326+
)]
13191327
#[rustc_builtin_macro]
13201328
#[macro_export]
13211329
macro_rules! asm {

src/libcore/prelude/v1.rs

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ pub use crate::fmt::macros::Debug;
5454
pub use crate::hash::macros::Hash;
5555

5656
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
57+
#[allow(deprecated)]
5758
#[doc(no_inline)]
5859
pub use crate::{
5960
asm, assert, cfg, column, compile_error, concat, concat_idents, env, file, format_args,

src/librustc_query_system/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ rustc_index = { path = "../librustc_index" }
1818
rustc_macros = { path = "../librustc_macros" }
1919
rustc_serialize = { path = "../libserialize", package = "serialize" }
2020
rustc_span = { path = "../librustc_span" }
21-
parking_lot = "0.9"
21+
parking_lot = "0.10"
2222
smallvec = { version = "1.0", features = ["union", "may_dangle"] }

src/libstd/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ pub use core::{
524524

525525
// Re-export built-in macros defined through libcore.
526526
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
527+
#[allow(deprecated)]
527528
pub use core::{
528529
asm, assert, cfg, column, compile_error, concat, concat_idents, env, file, format_args,
529530
format_args_nl, global_asm, include, include_bytes, include_str, line, llvm_asm, log_syntax,

src/libstd/prelude/v1.rs

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ pub use crate::result::Result::{self, Err, Ok};
3636

3737
// Re-exported built-in macros
3838
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
39+
#[allow(deprecated)]
3940
#[doc(no_inline)]
4041
pub use core::prelude::v1::{
4142
asm, assert, cfg, column, compile_error, concat, concat_idents, env, file, format_args,

src/test/ui/feature-gates/feature-gate-asm.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
fn main() {
44
unsafe {
55
asm!(""); //~ ERROR inline assembly is not stable enough
6+
//~^ WARN use of deprecated item 'asm'
67
llvm_asm!(""); //~ ERROR inline assembly is not stable enough
78
}
89
}

src/test/ui/feature-gates/feature-gate-asm.stderr

+10-2
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,22 @@ LL | asm!("");
88
= help: add `#![feature(asm)]` to the crate attributes to enable
99

1010
error[E0658]: use of unstable library feature 'llvm_asm': inline assembly is not stable enough for use and is subject to change
11-
--> $DIR/feature-gate-asm.rs:6:9
11+
--> $DIR/feature-gate-asm.rs:7:9
1212
|
1313
LL | llvm_asm!("");
1414
| ^^^^^^^^
1515
|
1616
= note: see issue #70173 <https://github.com/rust-lang/rust/issues/70173> for more information
1717
= help: add `#![feature(llvm_asm)]` to the crate attributes to enable
1818

19-
error: aborting due to 2 previous errors
19+
warning: use of deprecated item 'asm': the syntax of asm! will change soon, use llvm_asm! to avoid breakage
20+
--> $DIR/feature-gate-asm.rs:5:9
21+
|
22+
LL | asm!("");
23+
| ^^^ help: replace the use of the deprecated item: `llvm_asm`
24+
|
25+
= note: `#[warn(deprecated)]` on by default
26+
27+
error: aborting due to 2 previous errors; 1 warning emitted
2028

2129
For more information about this error, try `rustc --explain E0658`.

src/test/ui/feature-gates/feature-gate-asm2.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
fn main() {
44
unsafe {
55
println!("{:?}", asm!("")); //~ ERROR inline assembly is not stable
6+
//~^ WARN use of deprecated item 'asm'
67
println!("{:?}", llvm_asm!("")); //~ ERROR inline assembly is not stable
78
}
89
}

src/test/ui/feature-gates/feature-gate-asm2.stderr

+10-2
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,22 @@ LL | println!("{:?}", asm!(""));
88
= help: add `#![feature(asm)]` to the crate attributes to enable
99

1010
error[E0658]: use of unstable library feature 'llvm_asm': inline assembly is not stable enough for use and is subject to change
11-
--> $DIR/feature-gate-asm2.rs:6:26
11+
--> $DIR/feature-gate-asm2.rs:7:26
1212
|
1313
LL | println!("{:?}", llvm_asm!(""));
1414
| ^^^^^^^^
1515
|
1616
= note: see issue #70173 <https://github.com/rust-lang/rust/issues/70173> for more information
1717
= help: add `#![feature(llvm_asm)]` to the crate attributes to enable
1818

19-
error: aborting due to 2 previous errors
19+
warning: use of deprecated item 'asm': the syntax of asm! will change soon, use llvm_asm! to avoid breakage
20+
--> $DIR/feature-gate-asm2.rs:5:26
21+
|
22+
LL | println!("{:?}", asm!(""));
23+
| ^^^ help: replace the use of the deprecated item: `llvm_asm`
24+
|
25+
= note: `#[warn(deprecated)]` on by default
26+
27+
error: aborting due to 2 previous errors; 1 warning emitted
2028

2129
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
 (0)