Skip to content

Commit a0c954b

Browse files
authored
Merge pull request #742 from ojeda/rust-1.60
rust: upgrade to Rust 1.60
2 parents 4e89962 + a0cf6d6 commit a0c954b

File tree

16 files changed

+80
-63
lines changed

16 files changed

+80
-63
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
jobs:
88
ci:
99
runs-on: ubuntu-20.04
10-
container: ghcr.io/rust-for-linux/ci:Rust-1.59.0
10+
container: ghcr.io/rust-for-linux/ci:Rust-1.60.0
1111
timeout-minutes: 20
1212

1313
strategy:

Documentation/process/changes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ you probably needn't concern yourself with pcmciautils.
3131
====================== =============== ========================================
3232
GNU C 5.1 gcc --version
3333
Clang/LLVM (optional) 11.0.0 clang --version
34-
Rust (optional) 1.59.0 rustc --version
34+
Rust (optional) 1.60.0 rustc --version
3535
bindgen (optional) 0.56.0 bindgen --version
3636
GNU make 3.81 make --version
3737
binutils 2.23 ld -v

rust/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,8 @@ rust-analyzer:
348348
$(RUST_LIB_SRC) > $(objtree)/rust-project.json
349349

350350
$(obj)/core.o: private skip_clippy = 1
351-
$(obj)/core.o: private skip_flags = -Dunreachable_pub --edition=2021
352-
$(obj)/core.o: private rustc_target_flags = $(core-cfgs) --edition=2018
351+
$(obj)/core.o: private skip_flags = -Dunreachable_pub
352+
$(obj)/core.o: private rustc_target_flags = $(core-cfgs)
353353
$(obj)/core.o: $(RUST_LIB_SRC)/core/src/lib.rs $(obj)/target.json FORCE
354354
$(call if_changed_dep,rustc_library)
355355

rust/alloc/alloc.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,6 @@ extern "Rust" {
350350
// This is the magic symbol to call the global alloc error handler. rustc generates
351351
// it to call `__rg_oom` if there is a `#[alloc_error_handler]`, or to call the
352352
// default implementations below (`__rdl_oom`) otherwise.
353-
#[rustc_allocator_nounwind]
354353
fn __rust_alloc_error_handler(size: usize, align: usize) -> !;
355354
}
356355

@@ -369,7 +368,6 @@ extern "Rust" {
369368
#[stable(feature = "global_alloc", since = "1.28.0")]
370369
#[rustc_const_unstable(feature = "const_alloc_error", issue = "92523")]
371370
#[cfg(all(not(no_global_oom_handling), not(test)))]
372-
#[rustc_allocator_nounwind]
373371
#[cold]
374372
pub const fn handle_alloc_error(layout: Layout) -> ! {
375373
const fn ct_error(_: Layout) -> ! {
@@ -400,13 +398,13 @@ pub mod __alloc_error_handler {
400398

401399
// if there is no `#[alloc_error_handler]`
402400
#[rustc_std_internal_symbol]
403-
pub unsafe extern "C" fn __rdl_oom(size: usize, _align: usize) -> ! {
401+
pub unsafe extern "C-unwind" fn __rdl_oom(size: usize, _align: usize) -> ! {
404402
panic!("memory allocation of {} bytes failed", size)
405403
}
406404

407405
// if there is an `#[alloc_error_handler]`
408406
#[rustc_std_internal_symbol]
409-
pub unsafe extern "C" fn __rg_oom(size: usize, align: usize) -> ! {
407+
pub unsafe extern "C-unwind" fn __rg_oom(size: usize, align: usize) -> ! {
410408
let layout = unsafe { Layout::from_size_align_unchecked(size, align) };
411409
extern "Rust" {
412410
#[lang = "oom"]

rust/alloc/boxed.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
#![stable(feature = "rust1", since = "1.0.0")]
136136

137137
use core::any::Any;
138+
use core::async_iter::AsyncIterator;
138139
use core::borrow;
139140
use core::cmp::Ordering;
140141
use core::convert::{From, TryFrom};
@@ -151,7 +152,6 @@ use core::ops::{
151152
};
152153
use core::pin::Pin;
153154
use core::ptr::{self, Unique};
154-
use core::stream::Stream;
155155
use core::task::{Context, Poll};
156156

157157
#[cfg(not(no_global_oom_handling))]
@@ -1172,8 +1172,7 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
11721172
}
11731173

11741174
#[stable(feature = "rust1", since = "1.0.0")]
1175-
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
1176-
unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> const Drop for Box<T, A> {
1175+
unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> Drop for Box<T, A> {
11771176
fn drop(&mut self) {
11781177
// FIXME: Do nothing, drop is currently performed by compiler.
11791178
}
@@ -1994,8 +1993,8 @@ where
19941993
}
19951994
}
19961995

1997-
#[unstable(feature = "async_stream", issue = "79024")]
1998-
impl<S: ?Sized + Stream + Unpin> Stream for Box<S> {
1996+
#[unstable(feature = "async_iterator", issue = "79024")]
1997+
impl<S: ?Sized + AsyncIterator + Unpin> AsyncIterator for Box<S> {
19991998
type Item = S::Item;
20001999

20012000
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {

rust/alloc/collections/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ pub mod vec_deque;
1616
#[cfg(not(no_global_oom_handling))]
1717
#[stable(feature = "rust1", since = "1.0.0")]
1818
pub mod btree_map {
19-
//! A map based on a B-Tree.
19+
//! An ordered map based on a B-Tree.
2020
#[stable(feature = "rust1", since = "1.0.0")]
2121
pub use super::btree::map::*;
2222
}
2323

2424
#[cfg(not(no_global_oom_handling))]
2525
#[stable(feature = "rust1", since = "1.0.0")]
2626
pub mod btree_set {
27-
//! A set based on a B-Tree.
27+
//! An ordered set based on a B-Tree.
2828
#[stable(feature = "rust1", since = "1.0.0")]
2929
pub use super::btree::set::*;
3030
}

rust/alloc/fmt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
//! identifier '=' expression
7777
//! ```
7878
//!
79-
//! For example, the following [`format!`] expressions all use named argument:
79+
//! For example, the following [`format!`] expressions all use named arguments:
8080
//!
8181
//! ```
8282
//! format!("{argument}", argument = "test"); // => "test"

rust/alloc/lib.rs

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,14 @@
6969
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
7070
test(no_crate_inject, attr(allow(unused_variables), deny(warnings)))
7171
)]
72-
#![cfg_attr(
73-
not(bootstrap),
74-
doc(cfg_hide(
75-
not(test),
76-
not(any(test, bootstrap)),
77-
any(not(feature = "miri-test-libstd"), test, doctest),
78-
no_global_oom_handling,
79-
not(no_global_oom_handling),
80-
target_has_atomic = "ptr"
81-
))
82-
)]
72+
#![doc(cfg_hide(
73+
not(test),
74+
not(any(test, bootstrap)),
75+
any(not(feature = "miri-test-libstd"), test, doctest),
76+
no_global_oom_handling,
77+
not(no_global_oom_handling),
78+
target_has_atomic = "ptr"
79+
))]
8380
#![no_std]
8481
#![needs_allocator]
8582
//
@@ -96,7 +93,7 @@
9693
#![feature(array_chunks)]
9794
#![feature(array_methods)]
9895
#![feature(array_windows)]
99-
#![feature(async_stream)]
96+
#![feature(async_iterator)]
10097
#![feature(coerce_unsized)]
10198
#![cfg_attr(not(no_global_oom_handling), feature(const_alloc_error))]
10299
#![feature(const_box)]
@@ -117,11 +114,9 @@
117114
#![feature(extend_one)]
118115
#![feature(fmt_internals)]
119116
#![feature(fn_traits)]
120-
#![feature(inherent_ascii_escape)]
121117
#![feature(inplace_iteration)]
122118
#![feature(iter_advance_by)]
123119
#![feature(layout_for_ptr)]
124-
#![feature(maybe_uninit_extra)]
125120
#![feature(maybe_uninit_slice)]
126121
#![cfg_attr(test, feature(new_uninit))]
127122
#![feature(nonnull_slice_from_raw_parts)]
@@ -146,15 +141,14 @@
146141
#![feature(associated_type_bounds)]
147142
#![feature(box_syntax)]
148143
#![feature(cfg_sanitize)]
149-
#![feature(cfg_target_has_atomic)]
144+
#![cfg_attr(bootstrap, feature(cfg_target_has_atomic))]
150145
#![feature(const_deref)]
151146
#![feature(const_fn_trait_bound)]
152147
#![feature(const_mut_refs)]
153148
#![feature(const_ptr_write)]
154149
#![feature(const_precise_live_drops)]
155150
#![feature(const_trait_impl)]
156151
#![feature(const_try)]
157-
#![cfg_attr(bootstrap, feature(destructuring_assignment))]
158152
#![feature(dropck_eyepatch)]
159153
#![feature(exclusive_range_pattern)]
160154
#![feature(fundamental)]
@@ -170,6 +164,7 @@
170164
#![cfg_attr(test, feature(test))]
171165
#![feature(unboxed_closures)]
172166
#![feature(unsized_fn_params)]
167+
#![feature(c_unwind)]
173168
//
174169
// Rustdoc features:
175170
#![feature(doc_cfg)]

rust/alloc/macros.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#[cfg(all(not(no_global_oom_handling), not(test)))]
4040
#[macro_export]
4141
#[stable(feature = "rust1", since = "1.0.0")]
42+
#[rustc_diagnostic_item = "vec_macro"]
4243
#[allow_internal_unstable(box_syntax, liballoc_internals)]
4344
macro_rules! vec {
4445
() => (

rust/alloc/raw_vec.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl<T, A: Allocator> RawVec<T, A> {
110110
// to round up a request of less than 8 bytes to at least 8 bytes.
111111
// - 4 if elements are moderate-sized (<= 1 KiB).
112112
// - 1 otherwise, to avoid wasting too much space for very short Vecs.
113-
const MIN_NON_ZERO_CAP: usize = if mem::size_of::<T>() == 1 {
113+
pub(crate) const MIN_NON_ZERO_CAP: usize = if mem::size_of::<T>() == 1 {
114114
8
115115
} else if mem::size_of::<T>() <= 1024 {
116116
4
@@ -341,6 +341,12 @@ impl<T, A: Allocator> RawVec<T, A> {
341341
}
342342
}
343343

344+
/// The same as `reserve_for_push`, but returns on errors instead of panicking or aborting.
345+
#[inline(never)]
346+
pub fn try_reserve_for_push(&mut self, len: usize) -> Result<(), TryReserveError> {
347+
self.grow_amortized(len, 1)
348+
}
349+
344350
/// Ensures that the buffer contains at least enough space to hold `len +
345351
/// additional` elements. If it doesn't already, will reallocate the
346352
/// minimum possible amount of memory necessary. Generally this will be

rust/alloc/slice.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ pub use core::slice::ArrayChunks;
110110
pub use core::slice::ArrayChunksMut;
111111
#[unstable(feature = "array_windows", issue = "75027")]
112112
pub use core::slice::ArrayWindows;
113-
#[unstable(feature = "inherent_ascii_escape", issue = "77174")]
113+
#[stable(feature = "inherent_ascii_escape", since = "1.60.0")]
114114
pub use core::slice::EscapeAscii;
115115
#[stable(feature = "slice_get_slice", since = "1.28.0")]
116116
pub use core::slice::SliceIndex;
@@ -425,7 +425,10 @@ impl<T> [T] {
425425

426426
/// Sorts the slice with a key extraction function.
427427
///
428-
/// During sorting, the key function is called only once per element.
428+
/// During sorting, the key function is called at most once per element, by using
429+
/// temporary storage to remember the results of key evaluation.
430+
/// The order of calls to the key function is unspecified and may change in future versions
431+
/// of the standard library.
429432
///
430433
/// This sort is stable (i.e., does not reorder equal elements) and *O*(*m* \* *n* + *n* \* log(*n*))
431434
/// worst-case, where the key function is *O*(*m*).

rust/alloc/string.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,17 +1630,24 @@ impl String {
16301630
self.vec.clear()
16311631
}
16321632

1633-
/// Creates a draining iterator that removes the specified range in the `String`
1634-
/// and yields the removed `chars`.
1633+
/// Removes the specified range from the string in bulk, returning all
1634+
/// removed characters as an iterator.
16351635
///
1636-
/// Note: The element range is removed even if the iterator is not
1637-
/// consumed until the end.
1636+
/// The returned iterator keeps a mutable borrow on the string to optimize
1637+
/// its implementation.
16381638
///
16391639
/// # Panics
16401640
///
16411641
/// Panics if the starting point or end point do not lie on a [`char`]
16421642
/// boundary, or if they're out of bounds.
16431643
///
1644+
/// # Leaking
1645+
///
1646+
/// If the returned iterator goes out of scope without being dropped (due to
1647+
/// [`core::mem::forget`], for example), the string may still contain a copy
1648+
/// of any drained characters, or may have lost characters arbitrarily,
1649+
/// including characters outside the range.
1650+
///
16441651
/// # Examples
16451652
///
16461653
/// Basic usage:
@@ -1654,7 +1661,7 @@ impl String {
16541661
/// assert_eq!(t, "α is alpha, ");
16551662
/// assert_eq!(s, "β is beta");
16561663
///
1657-
/// // A full range clears the string
1664+
/// // A full range clears the string, like `clear()` does
16581665
/// s.drain(..);
16591666
/// assert_eq!(s, "");
16601667
/// ```

rust/alloc/vec/into_iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ impl<T, A: Allocator> AsRef<[T]> for IntoIter<T, A> {
127127
#[stable(feature = "rust1", since = "1.0.0")]
128128
unsafe impl<T: Send, A: Allocator + Send> Send for IntoIter<T, A> {}
129129
#[stable(feature = "rust1", since = "1.0.0")]
130-
unsafe impl<T: Sync, A: Allocator> Sync for IntoIter<T, A> {}
130+
unsafe impl<T: Sync, A: Allocator + Sync> Sync for IntoIter<T, A> {}
131131

132132
#[stable(feature = "rust1", since = "1.0.0")]
133133
impl<T, A: Allocator> Iterator for IntoIter<T, A> {

0 commit comments

Comments
 (0)