Skip to content

Commit e0dd302

Browse files
committed
Merge from rustc
2 parents c6e9aab + 7714830 commit e0dd302

File tree

211 files changed

+2727
-3007
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

211 files changed

+2727
-3007
lines changed

alloc/benches/btree/map.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::collections::BTreeMap;
2-
use std::iter::Iterator;
32
use std::ops::RangeBounds;
43
use std::vec::Vec;
54

alloc/benches/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use rand::RngCore;
2-
use std::iter::{repeat, FromIterator};
2+
use std::iter::repeat;
33
use test::{black_box, Bencher};
44

55
#[bench]

alloc/src/boxed.rs

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,13 @@ use core::any::Any;
150150
use core::async_iter::AsyncIterator;
151151
use core::borrow;
152152
use core::cmp::Ordering;
153-
use core::convert::{From, TryFrom};
154153
use core::error::Error;
155154
use core::fmt;
156155
use core::future::Future;
157156
use core::hash::{Hash, Hasher};
158-
#[cfg(not(no_global_oom_handling))]
159-
use core::iter::FromIterator;
160-
use core::iter::{FusedIterator, Iterator};
157+
use core::iter::FusedIterator;
161158
use core::marker::Tuple;
162-
use core::marker::{Unpin, Unsize};
159+
use core::marker::Unsize;
163160
use core::mem;
164161
use core::ops::{
165162
CoerceUnsized, Deref, DerefMut, DispatchFromDyn, Generator, GeneratorState, Receiver,
@@ -579,8 +576,7 @@ impl<T, A: Allocator> Box<T, A> {
579576
///
580577
/// This conversion does not allocate on the heap and happens in place.
581578
#[unstable(feature = "box_into_boxed_slice", issue = "71582")]
582-
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
583-
pub const fn into_boxed_slice(boxed: Self) -> Box<[T], A> {
579+
pub fn into_boxed_slice(boxed: Self) -> Box<[T], A> {
584580
let (raw, alloc) = Box::into_raw_with_allocator(boxed);
585581
unsafe { Box::from_raw_in(raw as *mut [T; 1], alloc) }
586582
}
@@ -812,9 +808,8 @@ impl<T, A: Allocator> Box<mem::MaybeUninit<T>, A> {
812808
/// assert_eq!(*five, 5)
813809
/// ```
814810
#[unstable(feature = "new_uninit", issue = "63291")]
815-
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
816811
#[inline]
817-
pub const unsafe fn assume_init(self) -> Box<T, A> {
812+
pub unsafe fn assume_init(self) -> Box<T, A> {
818813
let (raw, alloc) = Box::into_raw_with_allocator(self);
819814
unsafe { Box::from_raw_in(raw as *mut T, alloc) }
820815
}
@@ -847,9 +842,8 @@ impl<T, A: Allocator> Box<mem::MaybeUninit<T>, A> {
847842
/// }
848843
/// ```
849844
#[unstable(feature = "new_uninit", issue = "63291")]
850-
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
851845
#[inline]
852-
pub const fn write(mut boxed: Self, value: T) -> Box<T, A> {
846+
pub fn write(mut boxed: Self, value: T) -> Box<T, A> {
853847
unsafe {
854848
(*boxed).write(value);
855849
boxed.assume_init()
@@ -1093,9 +1087,8 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
10931087
///
10941088
/// [memory layout]: self#memory-layout
10951089
#[unstable(feature = "allocator_api", issue = "32838")]
1096-
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
10971090
#[inline]
1098-
pub const fn into_raw_with_allocator(b: Self) -> (*mut T, A) {
1091+
pub fn into_raw_with_allocator(b: Self) -> (*mut T, A) {
10991092
let (leaked, alloc) = Box::into_unique(b);
11001093
(leaked.as_ptr(), alloc)
11011094
}
@@ -1105,10 +1098,9 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
11051098
issue = "none",
11061099
reason = "use `Box::leak(b).into()` or `Unique::from(Box::leak(b))` instead"
11071100
)]
1108-
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
11091101
#[inline]
11101102
#[doc(hidden)]
1111-
pub const fn into_unique(b: Self) -> (Unique<T>, A) {
1103+
pub fn into_unique(b: Self) -> (Unique<T>, A) {
11121104
// Box is recognized as a "unique pointer" by Stacked Borrows, but internally it is a
11131105
// raw pointer for the type system. Turning it directly into a raw pointer would not be
11141106
// recognized as "releasing" the unique pointer to permit aliased raw accesses,
@@ -1166,9 +1158,8 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
11661158
/// assert_eq!(*static_ref, [4, 2, 3]);
11671159
/// ```
11681160
#[stable(feature = "box_leak", since = "1.26.0")]
1169-
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
11701161
#[inline]
1171-
pub const fn leak<'a>(b: Self) -> &'a mut T
1162+
pub fn leak<'a>(b: Self) -> &'a mut T
11721163
where
11731164
A: 'a,
11741165
{
@@ -1237,8 +1228,7 @@ impl<T: Default> Default for Box<T> {
12371228

12381229
#[cfg(not(no_global_oom_handling))]
12391230
#[stable(feature = "rust1", since = "1.0.0")]
1240-
#[rustc_const_unstable(feature = "const_default_impls", issue = "87864")]
1241-
impl<T> const Default for Box<[T]> {
1231+
impl<T> Default for Box<[T]> {
12421232
#[inline]
12431233
fn default() -> Self {
12441234
let ptr: Unique<[T]> = Unique::<[T; 0]>::dangling();
@@ -1248,8 +1238,7 @@ impl<T> const Default for Box<[T]> {
12481238

12491239
#[cfg(not(no_global_oom_handling))]
12501240
#[stable(feature = "default_box_extra", since = "1.17.0")]
1251-
#[rustc_const_unstable(feature = "const_default_impls", issue = "87864")]
1252-
impl const Default for Box<str> {
1241+
impl Default for Box<str> {
12531242
#[inline]
12541243
fn default() -> Self {
12551244
// SAFETY: This is the same as `Unique::cast<U>` but with an unsized `U = str`.
@@ -1446,8 +1435,7 @@ impl<T> From<T> for Box<T> {
14461435
}
14471436

14481437
#[stable(feature = "pin", since = "1.33.0")]
1449-
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
1450-
impl<T: ?Sized, A: Allocator> const From<Box<T, A>> for Pin<Box<T, A>>
1438+
impl<T: ?Sized, A: Allocator> From<Box<T, A>> for Pin<Box<T, A>>
14511439
where
14521440
A: 'static,
14531441
{
@@ -1883,8 +1871,7 @@ impl<T: ?Sized, A: Allocator> fmt::Pointer for Box<T, A> {
18831871
}
18841872

18851873
#[stable(feature = "rust1", since = "1.0.0")]
1886-
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
1887-
impl<T: ?Sized, A: Allocator> const Deref for Box<T, A> {
1874+
impl<T: ?Sized, A: Allocator> Deref for Box<T, A> {
18881875
type Target = T;
18891876

18901877
fn deref(&self) -> &T {
@@ -1893,8 +1880,7 @@ impl<T: ?Sized, A: Allocator> const Deref for Box<T, A> {
18931880
}
18941881

18951882
#[stable(feature = "rust1", since = "1.0.0")]
1896-
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
1897-
impl<T: ?Sized, A: Allocator> const DerefMut for Box<T, A> {
1883+
impl<T: ?Sized, A: Allocator> DerefMut for Box<T, A> {
18981884
fn deref_mut(&mut self) -> &mut T {
18991885
&mut **self
19001886
}

alloc/src/boxed/thin.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use core::fmt::{self, Debug, Display, Formatter};
77
use core::marker::PhantomData;
88
#[cfg(not(no_global_oom_handling))]
99
use core::marker::Unsize;
10-
use core::mem;
10+
use core::mem::{self, SizedTypeProperties};
1111
use core::ops::{Deref, DerefMut};
1212
use core::ptr::Pointee;
1313
use core::ptr::{self, NonNull};
@@ -202,9 +202,7 @@ impl<H> WithHeader<H> {
202202
let ptr = if layout.size() == 0 {
203203
// Some paranoia checking, mostly so that the ThinBox tests are
204204
// more able to catch issues.
205-
debug_assert!(
206-
value_offset == 0 && mem::size_of::<T>() == 0 && mem::size_of::<H>() == 0
207-
);
205+
debug_assert!(value_offset == 0 && T::IS_ZST && H::IS_ZST);
208206
layout.dangling()
209207
} else {
210208
let ptr = alloc::alloc(layout);
@@ -249,9 +247,7 @@ impl<H> WithHeader<H> {
249247
alloc::dealloc(self.ptr.as_ptr().sub(value_offset), layout);
250248
} else {
251249
debug_assert!(
252-
value_offset == 0
253-
&& mem::size_of::<H>() == 0
254-
&& self.value_layout.size() == 0
250+
value_offset == 0 && H::IS_ZST && self.value_layout.size() == 0
255251
);
256252
}
257253
}

alloc/src/collections/binary_heap/mod.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
#![stable(feature = "rust1", since = "1.0.0")]
145145

146146
use core::fmt;
147-
use core::iter::{FromIterator, FusedIterator, InPlaceIterable, SourceIter, TrustedLen};
147+
use core::iter::{FusedIterator, InPlaceIterable, SourceIter, TrustedLen};
148148
use core::mem::{self, swap, ManuallyDrop};
149149
use core::num::NonZeroUsize;
150150
use core::ops::{Deref, DerefMut};
@@ -263,7 +263,6 @@ mod tests;
263263
/// more detailed analysis.
264264
///
265265
/// [`core::cmp::Reverse`]: core::cmp::Reverse
266-
/// [`Ord`]: core::cmp::Ord
267266
/// [`Cell`]: core::cell::Cell
268267
/// [`RefCell`]: core::cell::RefCell
269268
/// [push]: BinaryHeap::push
@@ -854,7 +853,7 @@ impl<T: Ord> BinaryHeap<T> {
854853
///
855854
/// assert_eq!(heap.into_sorted_vec(), [-10, 2, 4])
856855
/// ```
857-
#[stable(feature = "binary_heap_retain", since = "CURRENT_RUSTC_VERSION")]
856+
#[stable(feature = "binary_heap_retain", since = "1.70.0")]
858857
pub fn retain<F>(&mut self, mut f: F)
859858
where
860859
F: FnMut(&T) -> bool,
@@ -1418,7 +1417,6 @@ impl<T> FusedIterator for Iter<'_, T> {}
14181417
/// (provided by the [`IntoIterator`] trait). See its documentation for more.
14191418
///
14201419
/// [`into_iter`]: BinaryHeap::into_iter
1421-
/// [`IntoIterator`]: core::iter::IntoIterator
14221420
#[stable(feature = "rust1", since = "1.0.0")]
14231421
#[derive(Clone)]
14241422
pub struct IntoIter<T> {
@@ -1465,7 +1463,7 @@ impl<T> ExactSizeIterator for IntoIter<T> {
14651463
#[stable(feature = "fused", since = "1.26.0")]
14661464
impl<T> FusedIterator for IntoIter<T> {}
14671465

1468-
#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
1466+
#[stable(feature = "default_iters", since = "1.70.0")]
14691467
impl<T> Default for IntoIter<T> {
14701468
/// Creates an empty `binary_heap::IntoIter`.
14711469
///

0 commit comments

Comments
 (0)