Skip to content

Commit 5806ba3

Browse files
authored
Rollup merge of rust-lang#138162 - ehuss:library-2024, r=cuviper
Update the standard library to Rust 2024 This updates the standard library to Rust 2024. This includes the following notable changes: - Macros are updated to use new expression fragment specifiers. This PR includes a test to illustrate the changes, primarily allowing `const {...}` expressions now. - Some tests show a change in MIR drop order. We do not believe this will be an observable change ([see zulip discussion](https://rust-lang.zulipchat.com/#narrow/channel/268952-edition/topic/standard.20library.20migration/near/500972873)). Fixes rust-lang#133081
2 parents b60598f + d8f103c commit 5806ba3

File tree

18 files changed

+19
-19
lines changed

18 files changed

+19
-19
lines changed

alloc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repository = "https://github.com/rust-lang/rust.git"
88
description = "The Rust core allocation and collections library"
99
autotests = false
1010
autobenches = false
11-
edition = "2021"
11+
edition = "2024"
1212

1313
[lib]
1414
test = false

core/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ autobenches = false
99
# If you update this, be sure to update it in a bunch of other places too!
1010
# As of 2024, it was src/tools/opt-dist, the core-no-fp-fmt-parse test and
1111
# the version of the prelude imported in core/lib.rs.
12-
edition = "2021"
12+
edition = "2024"
1313

1414
[lib]
1515
test = false

core/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ extern crate self as core;
226226

227227
#[prelude_import]
228228
#[allow(unused)]
229-
use prelude::rust_2021::*;
229+
use prelude::rust_2024::*;
230230

231231
#[cfg(not(test))] // See #65860
232232
#[macro_use]

panic_abort/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.0.0"
44
license = "MIT OR Apache-2.0"
55
repository = "https://github.com/rust-lang/rust.git"
66
description = "Implementation of Rust panics via process aborts"
7-
edition = "2021"
7+
edition = "2024"
88

99
[lib]
1010
test = false

panic_unwind/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.0.0"
44
license = "MIT OR Apache-2.0"
55
repository = "https://github.com/rust-lang/rust.git"
66
description = "Implementation of Rust panics via stack unwinding"
7-
edition = "2021"
7+
edition = "2024"
88

99
[lib]
1010
test = false

proc_macro/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "proc_macro"
33
version = "0.0.0"
4-
edition = "2021"
4+
edition = "2024"
55

66
[dependencies]
77
std = { path = "../std" }

profiler_builtins/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "profiler_builtins"
33
version = "0.0.0"
4-
edition = "2021"
4+
edition = "2024"
55

66
[lib]
77
test = false

rustc-std-workspace-alloc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ license = 'MIT OR Apache-2.0'
55
description = """
66
Hack for the compiler's own build system
77
"""
8-
edition = "2021"
8+
edition = "2024"
99

1010
[lib]
1111
path = "lib.rs"

rustc-std-workspace-core/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ license = 'MIT OR Apache-2.0'
55
description = """
66
Hack for the compiler's own build system
77
"""
8-
edition = "2021"
8+
edition = "2024"
99

1010
[lib]
1111
path = "lib.rs"

rustc-std-workspace-std/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ license = 'MIT OR Apache-2.0'
55
description = """
66
Hack for the compiler's own build system
77
"""
8-
edition = "2021"
8+
edition = "2024"
99

1010
[lib]
1111
path = "lib.rs"

std/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ version = "0.0.0"
66
license = "MIT OR Apache-2.0"
77
repository = "https://github.com/rust-lang/rust.git"
88
description = "The Rust Standard Library"
9-
edition = "2021"
9+
edition = "2024"
1010
autobenches = false
1111

1212
[lib]

std/src/keyword_docs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ mod move_keyword {}
10641064
/// ```rust,compile_fail,E0502
10651065
/// let mut v = vec![0, 1];
10661066
/// let mut_ref_v = &mut v;
1067-
/// ##[allow(unused)]
1067+
/// # #[allow(unused)]
10681068
/// let ref_v = &v;
10691069
/// mut_ref_v.push(2);
10701070
/// ```

std/src/os/windows/process.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ impl<'a> ProcThreadAttributeListBuilder<'a> {
531531
/// pub Y: i16,
532532
/// }
533533
///
534-
/// extern "system" {
534+
/// unsafe extern "system" {
535535
/// fn CreatePipe(
536536
/// hreadpipe: *mut HANDLE,
537537
/// hwritepipe: *mut HANDLE,

sysroot/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cargo-features = ["public-dependency"]
33
[package]
44
name = "sysroot"
55
version = "0.0.0"
6-
edition = "2021"
6+
edition = "2024"
77

88
# this is a dummy crate to ensure that all required crates appear in the sysroot
99
[dependencies]

test/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cargo-features = ["public-dependency"]
33
[package]
44
name = "test"
55
version = "0.0.0"
6-
edition = "2021"
6+
edition = "2024"
77

88
[dependencies]
99
getopts = { version = "0.2.21", features = ['rustc-dep-of-std'] }

unwind/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "unwind"
33
version = "0.0.0"
44
license = "MIT OR Apache-2.0"
55
repository = "https://github.com/rust-lang/rust.git"
6-
edition = "2021"
6+
edition = "2024"
77
include = [
88
'/libunwind/*',
99
]

windows_targets/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "windows-targets"
33
description = "A drop-in replacement for the real windows-targets crate for use in std only."
44
version = "0.0.0"
5-
edition = "2021"
5+
edition = "2024"
66

77
[features]
88
# Enable using raw-dylib for Windows imports.

windows_targets/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub macro link {
1212
($library:literal $abi:literal $($link_name:literal)? $(#[$doc:meta])? fn $($function:tt)*) => (
1313
#[cfg_attr(not(target_arch = "x86"), link(name = $library, kind = "raw-dylib", modifiers = "+verbatim"))]
1414
#[cfg_attr(target_arch = "x86", link(name = $library, kind = "raw-dylib", modifiers = "+verbatim", import_name_type = "undecorated"))]
15-
extern $abi {
15+
unsafe extern $abi {
1616
$(#[link_name=$link_name])?
1717
pub fn $($function)*;
1818
}
@@ -26,7 +26,7 @@ pub macro link {
2626
// libraries below by using an empty extern block. This works because extern blocks are not
2727
// connected to the library given in the #[link] attribute.
2828
#[link(name = "kernel32")]
29-
extern $abi {
29+
unsafe extern $abi {
3030
$(#[link_name=$link_name])?
3131
pub fn $($function)*;
3232
}

0 commit comments

Comments
 (0)