Skip to content

Commit d8bf353

Browse files
committed
Auto merge of rust-lang#76975 - RalfJung:rollup-s2wiuqr, r=RalfJung
Rollup of 15 pull requests Successful merges: - rust-lang#76732 (Add docs for `BasicBlock`) - rust-lang#76832 (Let backends define custom targets) - rust-lang#76866 (Remove unused feature gates from library/ crates) - rust-lang#76875 (Move to intra-doc links in library/alloc/src/collections/binary_heap.rs) - rust-lang#76876 (Move to intra-doc links in collections/btree/map.rs and collections/linked_list.rs) - rust-lang#76877 (Move to intra-doc links in collections/vec_deque.rs and collections/vec_deque/drain.rs) - rust-lang#76878 (Move the version number to a plaintext file) - rust-lang#76883 (README.md: Remove prompts from code blocks) - rust-lang#76887 (Add missing examples on HashSet iter types) - rust-lang#76890 (use matches!() macro for simple if let conditions) - rust-lang#76891 (don't take `TyCtxt` by reference) - rust-lang#76910 (transmute: use diagnostic item) - rust-lang#76924 (Add tracking issue for feature(unix_socket_peek)) - rust-lang#76926 (BTreeMap: code readability tweaks) - rust-lang#76940 (Don't allow implementing trait directly on type-alias-impl-trait) Failed merges: r? `@ghost`
2 parents 20275c0 + 6ab4f59 commit d8bf353

File tree

15 files changed

+148
-86
lines changed

15 files changed

+148
-86
lines changed

alloc/src/collections/binary_heap.rs

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
//! [dijkstra]: https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm
1616
//! [sssp]: https://en.wikipedia.org/wiki/Shortest_path_problem
1717
//! [dir_graph]: https://en.wikipedia.org/wiki/Directed_graph
18-
//! [`BinaryHeap`]: struct.BinaryHeap.html
1918
//!
2019
//! ```
2120
//! use std::cmp::Ordering;
@@ -240,10 +239,10 @@ use super::SpecExtend;
240239
/// The value for `push` is an expected cost; the method documentation gives a
241240
/// more detailed analysis.
242241
///
243-
/// [push]: #method.push
244-
/// [pop]: #method.pop
245-
/// [peek]: #method.peek
246-
/// [peek\_mut]: #method.peek_mut
242+
/// [push]: BinaryHeap::push
243+
/// [pop]: BinaryHeap::pop
244+
/// [peek]: BinaryHeap::peek
245+
/// [peek\_mut]: BinaryHeap::peek_mut
247246
#[stable(feature = "rust1", since = "1.0.0")]
248247
pub struct BinaryHeap<T> {
249248
data: Vec<T>,
@@ -255,8 +254,7 @@ pub struct BinaryHeap<T> {
255254
/// This `struct` is created by the [`peek_mut`] method on [`BinaryHeap`]. See
256255
/// its documentation for more.
257256
///
258-
/// [`peek_mut`]: struct.BinaryHeap.html#method.peek_mut
259-
/// [`BinaryHeap`]: struct.BinaryHeap.html
257+
/// [`peek_mut`]: BinaryHeap::peek_mut
260258
#[stable(feature = "binary_heap_peek_mut", since = "1.12.0")]
261259
pub struct PeekMut<'a, T: 'a + Ord> {
262260
heap: &'a mut BinaryHeap<T>,
@@ -802,7 +800,7 @@ impl<T> BinaryHeap<T> {
802800
/// heap.push(4);
803801
/// ```
804802
///
805-
/// [`reserve`]: #method.reserve
803+
/// [`reserve`]: BinaryHeap::reserve
806804
#[stable(feature = "rust1", since = "1.0.0")]
807805
pub fn reserve_exact(&mut self, additional: usize) {
808806
self.data.reserve_exact(additional);
@@ -1057,11 +1055,10 @@ impl<T> Drop for Hole<'_, T> {
10571055

10581056
/// An iterator over the elements of a `BinaryHeap`.
10591057
///
1060-
/// This `struct` is created by the [`iter`] method on [`BinaryHeap`]. See its
1058+
/// This `struct` is created by [`BinaryHeap::iter()`]. See its
10611059
/// documentation for more.
10621060
///
1063-
/// [`iter`]: struct.BinaryHeap.html#method.iter
1064-
/// [`BinaryHeap`]: struct.BinaryHeap.html
1061+
/// [`iter`]: BinaryHeap::iter
10651062
#[stable(feature = "rust1", since = "1.0.0")]
10661063
pub struct Iter<'a, T: 'a> {
10671064
iter: slice::Iter<'a, T>,
@@ -1122,11 +1119,10 @@ impl<T> FusedIterator for Iter<'_, T> {}
11221119

11231120
/// An owning iterator over the elements of a `BinaryHeap`.
11241121
///
1125-
/// This `struct` is created by the [`into_iter`] method on [`BinaryHeap`]
1122+
/// This `struct` is created by [`BinaryHeap::into_iter()`]
11261123
/// (provided by the `IntoIterator` trait). See its documentation for more.
11271124
///
1128-
/// [`into_iter`]: struct.BinaryHeap.html#method.into_iter
1129-
/// [`BinaryHeap`]: struct.BinaryHeap.html
1125+
/// [`into_iter`]: BinaryHeap::into_iter
11301126
#[stable(feature = "rust1", since = "1.0.0")]
11311127
#[derive(Clone)]
11321128
pub struct IntoIter<T> {
@@ -1227,11 +1223,10 @@ unsafe impl<T: Ord> TrustedLen for IntoIterSorted<T> {}
12271223

12281224
/// A draining iterator over the elements of a `BinaryHeap`.
12291225
///
1230-
/// This `struct` is created by the [`drain`] method on [`BinaryHeap`]. See its
1226+
/// This `struct` is created by [`BinaryHeap::drain()`]. See its
12311227
/// documentation for more.
12321228
///
1233-
/// [`drain`]: struct.BinaryHeap.html#method.drain
1234-
/// [`BinaryHeap`]: struct.BinaryHeap.html
1229+
/// [`drain`]: BinaryHeap::drain
12351230
#[stable(feature = "drain", since = "1.6.0")]
12361231
#[derive(Debug)]
12371232
pub struct Drain<'a, T: 'a> {
@@ -1273,11 +1268,10 @@ impl<T> FusedIterator for Drain<'_, T> {}
12731268

12741269
/// A draining iterator over the elements of a `BinaryHeap`.
12751270
///
1276-
/// This `struct` is created by the [`drain_sorted`] method on [`BinaryHeap`]. See its
1271+
/// This `struct` is created by [`BinaryHeap::drain_sorted()`]. See its
12771272
/// documentation for more.
12781273
///
1279-
/// [`drain_sorted`]: struct.BinaryHeap.html#method.drain_sorted
1280-
/// [`BinaryHeap`]: struct.BinaryHeap.html
1274+
/// [`drain_sorted`]: BinaryHeap::drain_sorted
12811275
#[unstable(feature = "binary_heap_drain_sorted", issue = "59278")]
12821276
#[derive(Debug)]
12831277
pub struct DrainSorted<'a, T: Ord> {

alloc/src/collections/btree/map.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ use UnderflowResult::*;
4747
/// any other key, as determined by the [`Ord`] trait, changes while it is in the map. This is
4848
/// normally only possible through [`Cell`], [`RefCell`], global state, I/O, or unsafe code.
4949
///
50-
/// [`Ord`]: core::cmp::Ord
5150
/// [`Cell`]: core::cell::Cell
5251
/// [`RefCell`]: core::cell::RefCell
5352
///
@@ -93,9 +92,10 @@ use UnderflowResult::*;
9392
/// }
9493
/// ```
9594
///
96-
/// `BTreeMap` also implements an [`Entry API`](#method.entry), which allows
97-
/// for more complex methods of getting, setting, updating and removing keys and
98-
/// their values:
95+
/// `BTreeMap` also implements an [`Entry API`], which allows for more complex
96+
/// methods of getting, setting, updating and removing keys and their values:
97+
///
98+
/// [`Entry API`]: BTreeMap::entry
9999
///
100100
/// ```
101101
/// use std::collections::BTreeMap;
@@ -453,8 +453,6 @@ impl<K: Debug + Ord, V: Debug> Debug for Entry<'_, K, V> {
453453

454454
/// A view into a vacant entry in a `BTreeMap`.
455455
/// It is part of the [`Entry`] enum.
456-
///
457-
/// [`Entry`]: enum.Entry.html
458456
#[stable(feature = "rust1", since = "1.0.0")]
459457
pub struct VacantEntry<'a, K: 'a, V: 'a> {
460458
key: K,
@@ -474,8 +472,6 @@ impl<K: Debug + Ord, V> Debug for VacantEntry<'_, K, V> {
474472

475473
/// A view into an occupied entry in a `BTreeMap`.
476474
/// It is part of the [`Entry`] enum.
477-
///
478-
/// [`Entry`]: enum.Entry.html
479475
#[stable(feature = "rust1", since = "1.0.0")]
480476
pub struct OccupiedEntry<'a, K: 'a, V: 'a> {
481477
handle: Handle<NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal>, marker::KV>,
@@ -815,7 +811,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
815811
/// types that can be `==` without being identical. See the [module-level
816812
/// documentation] for more.
817813
///
818-
/// [module-level documentation]: index.html#insert-and-complex-keys
814+
/// [module-level documentation]: crate::collections#insert-and-complex-keys
819815
///
820816
/// # Examples
821817
///
@@ -1719,7 +1715,7 @@ impl<'a, K: 'a, V: 'a> DrainFilterInner<'a, K, V> {
17191715
/// Allow Debug implementations to predict the next element.
17201716
pub(super) fn peek(&self) -> Option<(&K, &V)> {
17211717
let edge = self.cur_leaf_edge.as_ref()?;
1722-
edge.reborrow().next_kv().ok().map(|kv| kv.into_kv())
1718+
edge.reborrow().next_kv().ok().map(Handle::into_kv)
17231719
}
17241720

17251721
/// Implementation of a typical `DrainFilter::next` method, given the predicate.
@@ -2554,7 +2550,7 @@ impl<'a, K: Ord, V> OccupiedEntry<'a, K, V> {
25542550
/// If you need a reference to the `OccupiedEntry` that may outlive the
25552551
/// destruction of the `Entry` value, see [`into_mut`].
25562552
///
2557-
/// [`into_mut`]: #method.into_mut
2553+
/// [`into_mut`]: OccupiedEntry::into_mut
25582554
///
25592555
/// # Examples
25602556
///
@@ -2584,7 +2580,7 @@ impl<'a, K: Ord, V> OccupiedEntry<'a, K, V> {
25842580
///
25852581
/// If you need multiple references to the `OccupiedEntry`, see [`get_mut`].
25862582
///
2587-
/// [`get_mut`]: #method.get_mut
2583+
/// [`get_mut`]: OccupiedEntry::get_mut
25882584
///
25892585
/// # Examples
25902586
///

alloc/src/collections/btree/navigate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ impl<BorrowType, K, V> Handle<NodeRef<BorrowType, K, V, marker::Leaf>, marker::E
218218
let mut edge = self.forget_node_type();
219219
loop {
220220
edge = match edge.right_kv() {
221-
Ok(internal_kv) => return Ok(internal_kv),
221+
Ok(kv) => return Ok(kv),
222222
Err(last_edge) => match last_edge.into_node().ascend() {
223223
Ok(parent_edge) => parent_edge.forget_node_type(),
224224
Err(root) => return Err(root),
@@ -239,7 +239,7 @@ impl<BorrowType, K, V> Handle<NodeRef<BorrowType, K, V, marker::Leaf>, marker::E
239239
let mut edge = self.forget_node_type();
240240
loop {
241241
edge = match edge.left_kv() {
242-
Ok(internal_kv) => return Ok(internal_kv),
242+
Ok(kv) => return Ok(kv),
243243
Err(last_edge) => match last_edge.into_node().ascend() {
244244
Ok(parent_edge) => parent_edge.forget_node_type(),
245245
Err(root) => return Err(root),

alloc/src/collections/btree/node.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -929,14 +929,14 @@ impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, mark
929929
/// The returned pointer points to the inserted value.
930930
fn insert(mut self, key: K, val: V) -> (InsertResult<'a, K, V, marker::Leaf>, *mut V) {
931931
if self.node.len() < CAPACITY {
932-
let ptr = self.insert_fit(key, val);
932+
let val_ptr = self.insert_fit(key, val);
933933
let kv = unsafe { Handle::new_kv(self.node, self.idx) };
934-
(InsertResult::Fit(kv), ptr)
934+
(InsertResult::Fit(kv), val_ptr)
935935
} else {
936936
let (middle_kv_idx, insertion) = splitpoint(self.idx);
937937
let middle = unsafe { Handle::new_kv(self.node, middle_kv_idx) };
938938
let (mut left, k, v, mut right) = middle.split();
939-
let ptr = match insertion {
939+
let val_ptr = match insertion {
940940
InsertionPlace::Left(insert_idx) => unsafe {
941941
Handle::new_edge(left.reborrow_mut(), insert_idx).insert_fit(key, val)
942942
},
@@ -948,7 +948,7 @@ impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, mark
948948
.insert_fit(key, val)
949949
},
950950
};
951-
(InsertResult::Split(SplitResult { left: left.forget_type(), k, v, right }), ptr)
951+
(InsertResult::Split(SplitResult { left: left.forget_type(), k, v, right }), val_ptr)
952952
}
953953
}
954954
}

alloc/src/collections/linked_list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl<T: fmt::Debug> fmt::Debug for IterMut<'_, T> {
102102
/// This `struct` is created by the [`into_iter`] method on [`LinkedList`]
103103
/// (provided by the `IntoIterator` trait). See its documentation for more.
104104
///
105-
/// [`into_iter`]: struct.LinkedList.html#method.into_iter
105+
/// [`into_iter`]: LinkedList::into_iter
106106
#[derive(Clone)]
107107
#[stable(feature = "rust1", since = "1.0.0")]
108108
pub struct IntoIter<T> {

alloc/src/collections/vec_deque.rs

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ const MAXIMUM_ZST_CAPACITY: usize = 1 << (core::mem::size_of::<usize>() * 8 - 1)
4848
/// so that its elements do not wrap, and returns a mutable slice to the
4949
/// now-contiguous element sequence.
5050
///
51-
/// [`push_back`]: #method.push_back
52-
/// [`pop_front`]: #method.pop_front
53-
/// [`extend`]: #method.extend
54-
/// [`append`]: #method.append
55-
/// [`make_contiguous`]: #method.make_contiguous
51+
/// [`push_back`]: VecDeque::push_back
52+
/// [`pop_front`]: VecDeque::pop_front
53+
/// [`extend`]: VecDeque::extend
54+
/// [`append`]: VecDeque::append
55+
/// [`make_contiguous`]: VecDeque::make_contiguous
5656
#[cfg_attr(not(test), rustc_diagnostic_item = "vecdeque_type")]
5757
#[stable(feature = "rust1", since = "1.0.0")]
5858
pub struct VecDeque<T> {
@@ -640,7 +640,7 @@ impl<T> VecDeque<T> {
640640
/// assert!(buf.capacity() >= 11);
641641
/// ```
642642
///
643-
/// [`reserve`]: #method.reserve
643+
/// [`reserve`]: VecDeque::reserve
644644
#[stable(feature = "rust1", since = "1.0.0")]
645645
pub fn reserve_exact(&mut self, additional: usize) {
646646
self.reserve(additional);
@@ -987,8 +987,10 @@ impl<T> VecDeque<T> {
987987
/// Returns a pair of slices which contain, in order, the contents of the
988988
/// `VecDeque`.
989989
///
990-
/// If [`make_contiguous`](#method.make_contiguous) was previously called, all elements
991-
/// of the `VecDeque` will be in the first slice and the second slice will be empty.
990+
/// If [`make_contiguous`] was previously called, all elements of the
991+
/// `VecDeque` will be in the first slice and the second slice will be empty.
992+
///
993+
/// [`make_contiguous`]: VecDeque::make_contiguous
992994
///
993995
/// # Examples
994996
///
@@ -1020,8 +1022,10 @@ impl<T> VecDeque<T> {
10201022
/// Returns a pair of slices which contain, in order, the contents of the
10211023
/// `VecDeque`.
10221024
///
1023-
/// If [`make_contiguous`](#method.make_contiguous) was previously called, all elements
1024-
/// of the `VecDeque` will be in the first slice and the second slice will be empty.
1025+
/// If [`make_contiguous`] was previously called, all elements of the
1026+
/// `VecDeque` will be in the first slice and the second slice will be empty.
1027+
///
1028+
/// [`make_contiguous`]: VecDeque::make_contiguous
10251029
///
10261030
/// # Examples
10271031
///
@@ -2160,15 +2164,20 @@ impl<T> VecDeque<T> {
21602164
}
21612165
}
21622166

2163-
/// Rearranges the internal storage of this deque so it is one contiguous slice, which is then returned.
2167+
/// Rearranges the internal storage of this deque so it is one contiguous
2168+
/// slice, which is then returned.
21642169
///
2165-
/// This method does not allocate and does not change the order of the inserted elements.
2166-
/// As it returns a mutable slice, this can be used to sort or binary search a deque.
2170+
/// This method does not allocate and does not change the order of the
2171+
/// inserted elements. As it returns a mutable slice, this can be used to
2172+
/// sort or binary search a deque.
21672173
///
2168-
/// Once the internal storage is contiguous, the [`as_slices`](#method.as_slices) and
2169-
/// [`as_mut_slices`](#method.as_mut_slices) methods will return the entire contents of the
2174+
/// Once the internal storage is contiguous, the [`as_slices`] and
2175+
/// [`as_mut_slices`] methods will return the entire contents of the
21702176
/// `VecDeque` in a single slice.
21712177
///
2178+
/// [`as_slices`]: VecDeque::as_slices
2179+
/// [`as_mut_slices`]: VecDeque::as_mut_slices
2180+
///
21722181
/// # Examples
21732182
///
21742183
/// Sorting the content of a deque.
@@ -2495,8 +2504,7 @@ fn count(tail: usize, head: usize, size: usize) -> usize {
24952504
/// This `struct` is created by the [`iter`] method on [`VecDeque`]. See its
24962505
/// documentation for more.
24972506
///
2498-
/// [`iter`]: struct.VecDeque.html#method.iter
2499-
/// [`VecDeque`]: struct.VecDeque.html
2507+
/// [`iter`]: VecDeque::iter
25002508
#[stable(feature = "rust1", since = "1.0.0")]
25012509
pub struct Iter<'a, T: 'a> {
25022510
ring: &'a [T],
@@ -2650,8 +2658,7 @@ impl<T> FusedIterator for Iter<'_, T> {}
26502658
/// This `struct` is created by the [`iter_mut`] method on [`VecDeque`]. See its
26512659
/// documentation for more.
26522660
///
2653-
/// [`iter_mut`]: struct.VecDeque.html#method.iter_mut
2654-
/// [`VecDeque`]: struct.VecDeque.html
2661+
/// [`iter_mut`]: VecDeque::iter_mut
26552662
#[stable(feature = "rust1", since = "1.0.0")]
26562663
pub struct IterMut<'a, T: 'a> {
26572664
ring: &'a mut [T],
@@ -2756,8 +2763,7 @@ impl<T> FusedIterator for IterMut<'_, T> {}
27562763
/// This `struct` is created by the [`into_iter`] method on [`VecDeque`]
27572764
/// (provided by the `IntoIterator` trait). See its documentation for more.
27582765
///
2759-
/// [`into_iter`]: struct.VecDeque.html#method.into_iter
2760-
/// [`VecDeque`]: struct.VecDeque.html
2766+
/// [`into_iter`]: VecDeque::into_iter
27612767
#[derive(Clone)]
27622768
#[stable(feature = "rust1", since = "1.0.0")]
27632769
pub struct IntoIter<T> {

alloc/src/collections/vec_deque/drain.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ use super::{count, Iter, VecDeque};
99
/// This `struct` is created by the [`drain`] method on [`VecDeque`]. See its
1010
/// documentation for more.
1111
///
12-
/// [`drain`]: struct.VecDeque.html#method.drain
13-
/// [`VecDeque`]: struct.VecDeque.html
12+
/// [`drain`]: VecDeque::drain
1413
#[stable(feature = "drain", since = "1.6.0")]
1514
pub struct Drain<'a, T: 'a> {
1615
pub(crate) after_tail: usize,

alloc/src/lib.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,25 +74,23 @@
7474
#![deny(unsafe_op_in_unsafe_fn)]
7575
#![cfg_attr(not(test), feature(generator_trait))]
7676
#![cfg_attr(test, feature(test))]
77+
#![cfg_attr(test, feature(new_uninit))]
7778
#![feature(allocator_api)]
7879
#![feature(array_chunks)]
7980
#![feature(array_windows)]
8081
#![feature(allow_internal_unstable)]
8182
#![feature(arbitrary_self_types)]
8283
#![feature(box_patterns)]
8384
#![feature(box_syntax)]
84-
#![feature(btree_drain_filter)]
8585
#![feature(cfg_sanitize)]
8686
#![feature(cfg_target_has_atomic)]
8787
#![feature(coerce_unsized)]
8888
#![feature(const_btree_new)]
8989
#![feature(const_generics)]
9090
#![feature(const_in_array_repeat_expressions)]
9191
#![feature(cow_is_borrowed)]
92-
#![feature(deque_range)]
9392
#![feature(dispatch_from_dyn)]
9493
#![feature(core_intrinsics)]
95-
#![feature(container_error_extra)]
9694
#![feature(dropck_eyepatch)]
9795
#![feature(exact_size_is_empty)]
9896
#![feature(exclusive_range_pattern)]
@@ -104,13 +102,9 @@
104102
#![feature(int_bits_const)]
105103
#![feature(lang_items)]
106104
#![feature(layout_for_ptr)]
107-
#![feature(libc)]
108-
#![feature(map_first_last)]
109-
#![feature(map_into_keys_values)]
110105
#![feature(maybe_uninit_ref)]
111106
#![feature(negative_impls)]
112107
#![feature(never_type)]
113-
#![feature(new_uninit)]
114108
#![feature(nll)]
115109
#![feature(nonnull_slice_from_raw_parts)]
116110
#![feature(optin_builtin_traits)]
@@ -125,10 +119,8 @@
125119
#![feature(slice_ptr_get)]
126120
#![feature(slice_ptr_len)]
127121
#![feature(staged_api)]
128-
#![feature(std_internals)]
129122
#![feature(str_internals)]
130123
#![feature(trusted_len)]
131-
#![feature(try_reserve)]
132124
#![feature(unboxed_closures)]
133125
#![feature(unicode_internals)]
134126
#![feature(unsafe_block_in_unsafe_fn)]

0 commit comments

Comments
 (0)