Skip to content

Commit c8523b7

Browse files
authored
Rollup 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 b90d0b3 + 43ee31f commit c8523b7

File tree

11 files changed

+45
-16
lines changed

11 files changed

+45
-16
lines changed

Cargo.lock

+12-12
Original file line numberDiff line numberDiff line change
@@ -1747,7 +1747,7 @@ checksum = "5b31c9b90731276fdd24d896f31bb10aecf2e5151733364ae81123186643d939"
17471747
dependencies = [
17481748
"jsonrpc-core",
17491749
"log",
1750-
"parking_lot 0.10.0",
1750+
"parking_lot 0.10.2",
17511751
"serde",
17521752
]
17531753

@@ -1866,9 +1866,9 @@ checksum = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83"
18661866

18671867
[[package]]
18681868
name = "lock_api"
1869-
version = "0.3.1"
1869+
version = "0.3.4"
18701870
source = "registry+https://github.com/rust-lang/crates.io-index"
1871-
checksum = "f8912e782533a93a167888781b836336a6ca5da6175c05944c86cf28c31104dc"
1871+
checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75"
18721872
dependencies = [
18731873
"scopeguard",
18741874
]
@@ -2406,12 +2406,12 @@ dependencies = [
24062406

24072407
[[package]]
24082408
name = "parking_lot"
2409-
version = "0.10.0"
2409+
version = "0.10.2"
24102410
source = "registry+https://github.com/rust-lang/crates.io-index"
2411-
checksum = "92e98c49ab0b7ce5b222f2cc9193fc4efe11c6d0bd4f648e374684a6857b1cfc"
2411+
checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e"
24122412
dependencies = [
24132413
"lock_api",
2414-
"parking_lot_core 0.7.0",
2414+
"parking_lot_core 0.7.1",
24152415
]
24162416

24172417
[[package]]
@@ -2431,9 +2431,9 @@ dependencies = [
24312431

24322432
[[package]]
24332433
name = "parking_lot_core"
2434-
version = "0.7.0"
2434+
version = "0.7.1"
24352435
source = "registry+https://github.com/rust-lang/crates.io-index"
2436-
checksum = "7582838484df45743c8434fbff785e8edf260c28748353d44bc0da32e0ceabf1"
2436+
checksum = "0e136c1904604defe99ce5fd71a28d473fa60a12255d511aa78a9ddf11237aeb"
24372437
dependencies = [
24382438
"cfg-if",
24392439
"cloudabi",
@@ -3251,7 +3251,7 @@ dependencies = [
32513251
"lazy_static 1.4.0",
32523252
"log",
32533253
"measureme",
3254-
"parking_lot 0.10.0",
3254+
"parking_lot 0.10.2",
32553255
"rustc-ap-graphviz",
32563256
"rustc-ap-rustc_index",
32573257
"rustc-ap-serialize",
@@ -3696,7 +3696,7 @@ dependencies = [
36963696
"lazy_static 1.4.0",
36973697
"log",
36983698
"measureme",
3699-
"parking_lot 0.10.0",
3699+
"parking_lot 0.10.2",
37003700
"rustc-hash",
37013701
"rustc-rayon",
37023702
"rustc-rayon-core",
@@ -3991,7 +3991,7 @@ dependencies = [
39913991
"jobserver",
39923992
"log",
39933993
"measureme",
3994-
"parking_lot 0.10.0",
3994+
"parking_lot 0.10.2",
39953995
"polonius-engine",
39963996
"rustc-rayon",
39973997
"rustc-rayon-core",
@@ -4140,7 +4140,7 @@ name = "rustc_query_system"
41404140
version = "0.0.0"
41414141
dependencies = [
41424142
"log",
4143-
"parking_lot 0.9.0",
4143+
"parking_lot 0.10.2",
41444144
"rustc-rayon-core",
41454145
"rustc_data_structures",
41464146
"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
@@ -523,6 +523,7 @@ pub use core::{
523523

524524
// Re-export built-in macros defined through libcore.
525525
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
526+
#[allow(deprecated)]
526527
pub use core::{
527528
asm, assert, cfg, column, compile_error, concat, concat_idents, env, file, format_args,
528529
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

+9-1
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+
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+
1927
error: aborting due to 2 previous errors
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

+9-1
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+
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+
1927
error: aborting due to 2 previous errors
2028

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

0 commit comments

Comments
 (0)