Skip to content

Commit 32e5120

Browse files
authored
Merge pull request torvalds#616 from ojeda/rust-1.58
Rust 1.58.0
2 parents 26e876d + c92c4d2 commit 32e5120

File tree

21 files changed

+157
-136
lines changed

21 files changed

+157
-136
lines changed

.github/workflows/ci.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
arch: [arm, arm64, ppc64le, riscv64, x86_64]
1515
toolchain: [gcc, clang, llvm]
1616
config: [debug, release]
17-
rustc: [1.57.0]
17+
rustc: [1.58.0]
1818
output: [src] # [src, build]
1919
install: [rustup] # [rustup, standalone]
2020
sysroot: [common] # [common, custom]
@@ -50,7 +50,7 @@ jobs:
5050
- arch: arm64
5151
toolchain: gcc
5252
config: debug
53-
rustc: 1.57.0
53+
rustc: 1.58.0
5454
output: build
5555
install: rustup
5656
sysroot: custom
@@ -59,7 +59,7 @@ jobs:
5959
- arch: arm64
6060
toolchain: llvm
6161
config: debug
62-
rustc: 1.57.0
62+
rustc: 1.58.0
6363
output: build
6464
install: rustup
6565
sysroot: custom
@@ -68,7 +68,7 @@ jobs:
6868
- arch: arm64
6969
toolchain: llvm
7070
config: release
71-
rustc: 1.57.0
71+
rustc: 1.58.0
7272
output: build
7373
install: rustup
7474
sysroot: custom
@@ -77,7 +77,7 @@ jobs:
7777
- arch: ppc64le
7878
toolchain: clang
7979
config: release
80-
rustc: 1.57.0
80+
rustc: 1.58.0
8181
output: build
8282
install: standalone
8383
sysroot: common
@@ -86,7 +86,7 @@ jobs:
8686
- arch: x86_64
8787
toolchain: llvm
8888
config: debug
89-
rustc: 1.57.0
89+
rustc: 1.58.0
9090
output: build
9191
install: standalone
9292
sysroot: custom
@@ -95,7 +95,7 @@ jobs:
9595
- arch: x86_64
9696
toolchain: llvm
9797
config: debug
98-
rustc: 1.57.0
98+
rustc: 1.58.0
9999
output: src
100100
install: rustup
101101
sysroot: common
@@ -104,7 +104,7 @@ jobs:
104104
- arch: x86_64
105105
toolchain: llvm
106106
config: release
107-
rustc: 1.57.0
107+
rustc: 1.58.0
108108
output: src
109109
install: rustup
110110
sysroot: common

Documentation/process/changes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ know what you are doing, use the exact version listed here. Please see
3636
====================== =============== ========================================
3737
GNU C 5.1 gcc --version
3838
Clang/LLVM (optional) 10.0.1 clang --version
39-
rustc (optional) 1.57.0 rustc --version
39+
rustc (optional) 1.58.0 rustc --version
4040
bindgen (optional) 0.56.0 bindgen --version
4141
GNU make 3.81 make --version
4242
binutils 2.23 ld -v

Documentation/rust/quick-start.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Rust features.
2626
If ``rustup`` is being used, enter the checked out source code directory
2727
and run::
2828

29-
rustup override set 1.57.0
29+
rustup override set 1.58.0
3030

3131
Otherwise, fetch a standalone installer or install ``rustup`` from:
3232

drivers/android/context.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub(crate) struct Context {
2121
manager: Mutex<Manager>,
2222
}
2323

24+
#[allow(clippy::non_send_fields_in_send_ty)]
2425
unsafe impl Send for Context {}
2526
unsafe impl Sync for Context {}
2627

drivers/android/process.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ pub(crate) struct Process {
260260
node_refs: Mutex<ProcessNodeRefs>,
261261
}
262262

263+
#[allow(clippy::non_send_fields_in_send_ty)]
263264
unsafe impl Send for Process {}
264265
unsafe impl Sync for Process {}
265266

rust/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,8 @@ $(objtree)/rust/kernel.o: $(srctree)/rust/kernel/lib.rs $(objtree)/rust/alloc.o
340340
# Targets that need to expand twice
341341
.SECONDEXPANSION:
342342
$(objtree)/rust/core.o: private skip_clippy = 1
343-
$(objtree)/rust/core.o: private skip_flags = -Dunreachable_pub
344-
$(objtree)/rust/core.o: private rustc_target_flags = $(core-cfgs)
343+
$(objtree)/rust/core.o: private skip_flags = -Dunreachable_pub --edition=2021
344+
$(objtree)/rust/core.o: private rustc_target_flags = $(core-cfgs) --edition=2018
345345
$(objtree)/rust/core.o: $$(RUST_LIB_SRC)/core/src/lib.rs FORCE
346346
$(call if_changed_dep,rustc_library)
347347

rust/alloc/alloc.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ pub use std::alloc::Global;
8383
/// }
8484
/// ```
8585
#[stable(feature = "global_alloc", since = "1.28.0")]
86+
#[must_use = "losing the pointer will leak memory"]
8687
#[inline]
8788
pub unsafe fn alloc(layout: Layout) -> *mut u8 {
8889
unsafe { __rust_alloc(layout.size(), layout.align()) }
@@ -119,6 +120,7 @@ pub unsafe fn dealloc(ptr: *mut u8, layout: Layout) {
119120
///
120121
/// See [`GlobalAlloc::realloc`].
121122
#[stable(feature = "global_alloc", since = "1.28.0")]
123+
#[must_use = "losing the pointer will leak memory"]
122124
#[inline]
123125
pub unsafe fn realloc(ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 {
124126
unsafe { __rust_realloc(ptr, layout.size(), layout.align(), new_size) }
@@ -152,6 +154,7 @@ pub unsafe fn realloc(ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8
152154
/// }
153155
/// ```
154156
#[stable(feature = "global_alloc", since = "1.28.0")]
157+
#[must_use = "losing the pointer will leak memory"]
155158
#[inline]
156159
pub unsafe fn alloc_zeroed(layout: Layout) -> *mut u8 {
157160
unsafe { __rust_alloc_zeroed(layout.size(), layout.align()) }

rust/alloc/boxed.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ use crate::vec::Vec;
171171
#[lang = "owned_box"]
172172
#[fundamental]
173173
#[stable(feature = "rust1", since = "1.0.0")]
174+
// The declaration of the `Box` struct must be kept in sync with the
175+
// `alloc::alloc::box_free` function or ICEs will happen. See the comment
176+
// on `box_free` for more details.
174177
pub struct Box<
175178
T: ?Sized,
176179
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,

rust/alloc/collections/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ pub struct TryReserveError {
6767
impl TryReserveError {
6868
/// Details about the allocation that caused the error
6969
#[inline]
70+
#[must_use]
7071
#[unstable(
7172
feature = "try_reserve_kind",
7273
reason = "Uncertain how much info should be exposed",

rust/alloc/fmt.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
//! format!("The number is {}", 1); // => "The number is 1"
2020
//! format!("{:?}", (3, 4)); // => "(3, 4)"
2121
//! format!("{value}", value=4); // => "4"
22+
//! let people = "Rustaceans";
23+
//! format!("Hello {people}!"); // => "Hello Rustaceans!"
2224
//! format!("{} {}", 1, 2); // => "1 2"
2325
//! format!("{:04}", 42); // => "0042" with leading zeros
2426
//! format!("{:#?}", (100, 200)); // => "(
@@ -82,6 +84,19 @@
8284
//! format!("{a} {c} {b}", a="a", b='b', c=3); // => "a 3 b"
8385
//! ```
8486
//!
87+
//! If a named parameter does not appear in the argument list, `format!` will
88+
//! reference a variable with that name in the current scope.
89+
//!
90+
//! ```
91+
//! let argument = 2 + 2;
92+
//! format!("{argument}"); // => "4"
93+
//!
94+
//! fn make_string(a: u32, b: &str) -> String {
95+
//! format!("{b} {a}")
96+
//! }
97+
//! make_string(927, "label"); // => "label 927"
98+
//! ```
99+
//!
85100
//! It is not valid to put positional parameters (those without names) after
86101
//! arguments that have names. Like with positional parameters, it is not
87102
//! valid to provide named parameters that are unused by the format string.
@@ -100,6 +115,8 @@
100115
//! println!("Hello {:1$}!", "x", 5);
101116
//! println!("Hello {1:0$}!", 5, "x");
102117
//! println!("Hello {:width$}!", "x", width = 5);
118+
//! let width = 5;
119+
//! println!("Hello {:width$}!", "x");
103120
//! ```
104121
//!
105122
//! This is a parameter for the "minimum width" that the format should take up.
@@ -574,6 +591,7 @@ use crate::string;
574591
/// [`format_args!`]: core::format_args
575592
/// [`format!`]: crate::format
576593
#[cfg(not(no_global_oom_handling))]
594+
#[must_use]
577595
#[stable(feature = "rust1", since = "1.0.0")]
578596
pub fn format(args: Arguments<'_>) -> string::String {
579597
let capacity = args.estimated_capacity();

0 commit comments

Comments
 (0)