summaryrefslogtreecommitdiffstats
path: root/library/alloc/src/collections/btree
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:24 +0000
commit023939b627b7dc93b01471f7d41fb8553ddb4ffa (patch)
tree60fc59477c605c72b0a1051409062ddecc43f877 /library/alloc/src/collections/btree
parentAdding debian version 1.72.1+dfsg1-1. (diff)
downloadrustc-023939b627b7dc93b01471f7d41fb8553ddb4ffa.tar.xz
rustc-023939b627b7dc93b01471f7d41fb8553ddb4ffa.zip
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/alloc/src/collections/btree')
-rw-r--r--library/alloc/src/collections/btree/map.rs62
-rw-r--r--library/alloc/src/collections/btree/set.rs13
2 files changed, 8 insertions, 67 deletions
diff --git a/library/alloc/src/collections/btree/map.rs b/library/alloc/src/collections/btree/map.rs
index ff908ec12..5481b327d 100644
--- a/library/alloc/src/collections/btree/map.rs
+++ b/library/alloc/src/collections/btree/map.rs
@@ -613,8 +613,6 @@ impl<K, V> BTreeMap<K, V> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// use std::collections::BTreeMap;
///
@@ -636,8 +634,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// use std::collections::BTreeMap;
///
@@ -661,8 +657,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// # #![feature(allocator_api)]
/// # #![feature(btreemap_alloc)]
@@ -688,8 +682,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// use std::collections::BTreeMap;
///
@@ -744,8 +736,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// use std::collections::BTreeMap;
///
@@ -830,8 +820,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// use std::collections::BTreeMap;
///
@@ -917,8 +905,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// use std::collections::BTreeMap;
///
@@ -943,8 +929,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// use std::collections::BTreeMap;
///
@@ -982,8 +966,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// use std::collections::BTreeMap;
///
@@ -1017,8 +999,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// #![feature(map_try_insert)]
///
@@ -1051,8 +1031,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// use std::collections::BTreeMap;
///
@@ -1078,8 +1056,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// use std::collections::BTreeMap;
///
@@ -1208,8 +1184,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// use std::collections::BTreeMap;
/// use std::ops::Bound::Included;
@@ -1251,8 +1225,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// use std::collections::BTreeMap;
///
@@ -1283,8 +1255,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// use std::collections::BTreeMap;
///
@@ -1336,8 +1306,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// use std::collections::BTreeMap;
///
@@ -2388,8 +2356,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// use std::collections::BTreeMap;
///
@@ -2420,8 +2386,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// use std::collections::BTreeMap;
///
@@ -2453,8 +2417,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// use std::collections::BTreeMap;
///
@@ -2474,8 +2436,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// use std::collections::BTreeMap;
///
@@ -2495,8 +2455,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// use std::collections::BTreeMap;
///
@@ -2521,8 +2479,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// use std::collections::BTreeMap;
///
@@ -2546,8 +2502,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// use std::collections::BTreeMap;
///
@@ -2578,8 +2532,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// #![feature(btree_cursors)]
///
@@ -2591,6 +2543,8 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
/// a.insert(2, "b");
/// a.insert(3, "c");
/// a.insert(4, "c");
+ /// let cursor = a.lower_bound(Bound::Included(&2));
+ /// assert_eq!(cursor.key(), Some(&2));
/// let cursor = a.lower_bound(Bound::Excluded(&2));
/// assert_eq!(cursor.key(), Some(&3));
/// ```
@@ -2619,8 +2573,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// #![feature(btree_cursors)]
///
@@ -2632,6 +2584,8 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
/// a.insert(2, "b");
/// a.insert(3, "c");
/// a.insert(4, "c");
+ /// let cursor = a.lower_bound_mut(Bound::Included(&2));
+ /// assert_eq!(cursor.key(), Some(&2));
/// let cursor = a.lower_bound_mut(Bound::Excluded(&2));
/// assert_eq!(cursor.key(), Some(&3));
/// ```
@@ -2673,8 +2627,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// #![feature(btree_cursors)]
///
@@ -2686,6 +2638,8 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
/// a.insert(2, "b");
/// a.insert(3, "c");
/// a.insert(4, "c");
+ /// let cursor = a.upper_bound(Bound::Included(&3));
+ /// assert_eq!(cursor.key(), Some(&3));
/// let cursor = a.upper_bound(Bound::Excluded(&3));
/// assert_eq!(cursor.key(), Some(&2));
/// ```
@@ -2714,8 +2668,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// # Examples
///
- /// Basic usage:
- ///
/// ```
/// #![feature(btree_cursors)]
///
@@ -2727,6 +2679,8 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
/// a.insert(2, "b");
/// a.insert(3, "c");
/// a.insert(4, "c");
+ /// let cursor = a.upper_bound_mut(Bound::Included(&3));
+ /// assert_eq!(cursor.key(), Some(&3));
/// let cursor = a.upper_bound_mut(Bound::Excluded(&3));
/// assert_eq!(cursor.key(), Some(&2));
/// ```
diff --git a/library/alloc/src/collections/btree/set.rs b/library/alloc/src/collections/btree/set.rs
index c4461040b..9da230915 100644
--- a/library/alloc/src/collections/btree/set.rs
+++ b/library/alloc/src/collections/btree/set.rs
@@ -1121,19 +1121,6 @@ impl<T, A: Allocator + Clone> BTreeSet<T, A> {
/// ```
/// use std::collections::BTreeSet;
///
- /// let set = BTreeSet::from([1, 2, 3]);
- /// let mut set_iter = set.iter();
- /// assert_eq!(set_iter.next(), Some(&1));
- /// assert_eq!(set_iter.next(), Some(&2));
- /// assert_eq!(set_iter.next(), Some(&3));
- /// assert_eq!(set_iter.next(), None);
- /// ```
- ///
- /// Values returned by the iterator are returned in ascending order:
- ///
- /// ```
- /// use std::collections::BTreeSet;
- ///
/// let set = BTreeSet::from([3, 1, 2]);
/// let mut set_iter = set.iter();
/// assert_eq!(set_iter.next(), Some(&1));