Skip to content

Commit 7c5053c

Browse files
Seppel3210gitbot
authored and
gitbot
committed
Merge branch 'master' of https://github.com/rust-lang/rust
2 parents e1bc368 + e0e84e6 commit 7c5053c

Some content is hidden

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

64 files changed

+1455
-708
lines changed

alloc/benches/vec.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -551,19 +551,13 @@ const LEN: usize = 16384;
551551
#[bench]
552552
fn bench_chain_collect(b: &mut Bencher) {
553553
let data = black_box([0; LEN]);
554-
b.iter(|| data.iter().cloned().chain([1].iter().cloned()).collect::<Vec<_>>());
554+
b.iter(|| data.iter().cloned().chain([1]).collect::<Vec<_>>());
555555
}
556556

557557
#[bench]
558558
fn bench_chain_chain_collect(b: &mut Bencher) {
559559
let data = black_box([0; LEN]);
560-
b.iter(|| {
561-
data.iter()
562-
.cloned()
563-
.chain([1].iter().cloned())
564-
.chain([2].iter().cloned())
565-
.collect::<Vec<_>>()
566-
});
560+
b.iter(|| data.iter().cloned().chain([1]).chain([2]).collect::<Vec<_>>());
567561
}
568562

569563
#[bench]

alloc/src/collections/linked_list.rs

+20-7
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,15 @@ pub struct Iter<'a, T: 'a> {
6464
#[stable(feature = "collection_debug", since = "1.17.0")]
6565
impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> {
6666
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
67-
f.debug_tuple("Iter").field(&self.len).finish()
67+
f.debug_tuple("Iter")
68+
.field(&*mem::ManuallyDrop::new(LinkedList {
69+
head: self.head,
70+
tail: self.tail,
71+
len: self.len,
72+
marker: PhantomData,
73+
}))
74+
.field(&self.len)
75+
.finish()
6876
}
6977
}
7078

@@ -82,19 +90,24 @@ impl<T> Clone for Iter<'_, T> {
8290
/// documentation for more.
8391
#[stable(feature = "rust1", since = "1.0.0")]
8492
pub struct IterMut<'a, T: 'a> {
85-
// We do *not* exclusively own the entire list here, references to node's `element`
86-
// have been handed out by the iterator! So be careful when using this; the methods
87-
// called must be aware that there can be aliasing pointers to `element`.
88-
list: &'a mut LinkedList<T>,
8993
head: Option<NonNull<Node<T>>>,
9094
tail: Option<NonNull<Node<T>>>,
9195
len: usize,
96+
marker: PhantomData<&'a mut Node<T>>,
9297
}
9398

9499
#[stable(feature = "collection_debug", since = "1.17.0")]
95100
impl<T: fmt::Debug> fmt::Debug for IterMut<'_, T> {
96101
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
97-
f.debug_tuple("IterMut").field(&self.list).field(&self.len).finish()
102+
f.debug_tuple("IterMut")
103+
.field(&*mem::ManuallyDrop::new(LinkedList {
104+
head: self.head,
105+
tail: self.tail,
106+
len: self.len,
107+
marker: PhantomData,
108+
}))
109+
.field(&self.len)
110+
.finish()
98111
}
99112
}
100113

@@ -493,7 +506,7 @@ impl<T> LinkedList<T> {
493506
#[inline]
494507
#[stable(feature = "rust1", since = "1.0.0")]
495508
pub fn iter_mut(&mut self) -> IterMut<'_, T> {
496-
IterMut { head: self.head, tail: self.tail, len: self.len, list: self }
509+
IterMut { head: self.head, tail: self.tail, len: self.len, marker: PhantomData }
497510
}
498511

499512
/// Provides a cursor at the front element.

alloc/src/collections/vec_deque/mod.rs

+4-9
Original file line numberDiff line numberDiff line change
@@ -2416,7 +2416,6 @@ impl<T> VecDeque<T> {
24162416
/// found; the fourth could match any position in `[1, 4]`.
24172417
///
24182418
/// ```
2419-
/// #![feature(vecdeque_binary_search)]
24202419
/// use std::collections::VecDeque;
24212420
///
24222421
/// let deque: VecDeque<_> = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55].into();
@@ -2432,7 +2431,6 @@ impl<T> VecDeque<T> {
24322431
/// sort order:
24332432
///
24342433
/// ```
2435-
/// #![feature(vecdeque_binary_search)]
24362434
/// use std::collections::VecDeque;
24372435
///
24382436
/// let mut deque: VecDeque<_> = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55].into();
@@ -2441,7 +2439,7 @@ impl<T> VecDeque<T> {
24412439
/// deque.insert(idx, num);
24422440
/// assert_eq!(deque, &[0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]);
24432441
/// ```
2444-
#[unstable(feature = "vecdeque_binary_search", issue = "78021")]
2442+
#[stable(feature = "vecdeque_binary_search", since = "1.54.0")]
24452443
#[inline]
24462444
pub fn binary_search(&self, x: &T) -> Result<usize, usize>
24472445
where
@@ -2476,7 +2474,6 @@ impl<T> VecDeque<T> {
24762474
/// found; the fourth could match any position in `[1, 4]`.
24772475
///
24782476
/// ```
2479-
/// #![feature(vecdeque_binary_search)]
24802477
/// use std::collections::VecDeque;
24812478
///
24822479
/// let deque: VecDeque<_> = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55].into();
@@ -2487,7 +2484,7 @@ impl<T> VecDeque<T> {
24872484
/// let r = deque.binary_search_by(|x| x.cmp(&1));
24882485
/// assert!(matches!(r, Ok(1..=4)));
24892486
/// ```
2490-
#[unstable(feature = "vecdeque_binary_search", issue = "78021")]
2487+
#[stable(feature = "vecdeque_binary_search", since = "1.54.0")]
24912488
pub fn binary_search_by<'a, F>(&'a self, mut f: F) -> Result<usize, usize>
24922489
where
24932490
F: FnMut(&'a T) -> Ordering,
@@ -2530,7 +2527,6 @@ impl<T> VecDeque<T> {
25302527
/// fourth could match any position in `[1, 4]`.
25312528
///
25322529
/// ```
2533-
/// #![feature(vecdeque_binary_search)]
25342530
/// use std::collections::VecDeque;
25352531
///
25362532
/// let deque: VecDeque<_> = vec![(0, 0), (2, 1), (4, 1), (5, 1),
@@ -2543,7 +2539,7 @@ impl<T> VecDeque<T> {
25432539
/// let r = deque.binary_search_by_key(&1, |&(a, b)| b);
25442540
/// assert!(matches!(r, Ok(1..=4)));
25452541
/// ```
2546-
#[unstable(feature = "vecdeque_binary_search", issue = "78021")]
2542+
#[stable(feature = "vecdeque_binary_search", since = "1.54.0")]
25472543
#[inline]
25482544
pub fn binary_search_by_key<'a, B, F>(&'a self, b: &B, mut f: F) -> Result<usize, usize>
25492545
where
@@ -2574,7 +2570,6 @@ impl<T> VecDeque<T> {
25742570
/// # Examples
25752571
///
25762572
/// ```
2577-
/// #![feature(vecdeque_binary_search)]
25782573
/// use std::collections::VecDeque;
25792574
///
25802575
/// let deque: VecDeque<_> = vec![1, 2, 3, 3, 5, 6, 7].into();
@@ -2584,7 +2579,7 @@ impl<T> VecDeque<T> {
25842579
/// assert!(deque.iter().take(i).all(|&x| x < 5));
25852580
/// assert!(deque.iter().skip(i).all(|&x| !(x < 5)));
25862581
/// ```
2587-
#[unstable(feature = "vecdeque_binary_search", issue = "78021")]
2582+
#[stable(feature = "vecdeque_binary_search", since = "1.54.0")]
25882583
pub fn partition_point<P>(&self, mut pred: P) -> usize
25892584
where
25902585
P: FnMut(&T) -> bool,

alloc/src/collections/vec_deque/pair_slices.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use core::array;
21
use core::cmp::{self};
32
use core::mem::replace;
43

@@ -37,7 +36,7 @@ impl<'a, 'b, T> PairSlices<'a, 'b, T> {
3736
}
3837

3938
pub fn remainder(self) -> impl Iterator<Item = &'b [T]> {
40-
array::IntoIter::new([self.b0, self.b1])
39+
IntoIterator::into_iter([self.b0, self.b1])
4140
}
4241
}
4342

alloc/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
#![allow(unused_attributes)]
6060
#![stable(feature = "alloc", since = "1.36.0")]
6161
#![doc(
62-
html_root_url = "https://doc.rust-lang.org/nightly/",
6362
html_playground_url = "https://play.rust-lang.org/",
6463
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
6564
test(no_crate_inject, attr(allow(unused_variables), deny(warnings)))
@@ -144,6 +143,7 @@
144143
#![feature(associated_type_bounds)]
145144
#![feature(slice_group_by)]
146145
#![feature(decl_macro)]
146+
#![feature(bindings_after_at)]
147147
// Allow testing this library
148148

149149
#[cfg(test)]

0 commit comments

Comments
 (0)