Skip to content

Commit 6f481f8

Browse files
committed
Auto merge of rust-lang#97600 - matthiaskrgr:rollup-yivyeu5, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - rust-lang#97316 (Put a bound on collection misbehavior) - rust-lang#97578 (alloc: remove repeated word in comment) - rust-lang#97593 (:arrow_up: rust-analyzer) - rust-lang#97596 (Fixup feature name to be more consistent with others) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents e094492 + 31fccd1 commit 6f481f8

File tree

8 files changed

+23
-20
lines changed

8 files changed

+23
-20
lines changed

Diff for: library/alloc/src/collections/binary_heap.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,10 @@ mod tests;
166166
/// item's ordering relative to any other item, as determined by the [`Ord`]
167167
/// trait, changes while it is in the heap. This is normally only possible
168168
/// through [`Cell`], [`RefCell`], global state, I/O, or unsafe code. The
169-
/// behavior resulting from such a logic error is not specified (it
170-
/// could include panics, incorrect results, aborts, memory leaks, or
171-
/// non-termination) but will not be undefined behavior.
169+
/// behavior resulting from such a logic error is not specified, but will
170+
/// be encapsulated to the `BinaryHeap` that observed the logic error and not
171+
/// result in undefined behavior. This could include panics, incorrect results,
172+
/// aborts, memory leaks, and non-termination.
172173
///
173174
/// # Examples
174175
///

Diff for: library/alloc/src/collections/btree/map.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ pub(super) const MIN_LEN: usize = node::MIN_LEN_AFTER_SPLIT;
6464
/// It is a logic error for a key to be modified in such a way that the key's ordering relative to
6565
/// any other key, as determined by the [`Ord`] trait, changes while it is in the map. This is
6666
/// normally only possible through [`Cell`], [`RefCell`], global state, I/O, or unsafe code.
67-
/// The behavior resulting from such a logic error is not specified (it could include panics,
68-
/// incorrect results, aborts, memory leaks, or non-termination) but will not be undefined
69-
/// behavior.
67+
/// The behavior resulting from such a logic error is not specified, but will be encapsulated to the
68+
/// `BTreeMap` that observed the logic error and not result in undefined behavior. This could
69+
/// include panics, incorrect results, aborts, memory leaks, and non-termination.
7070
///
7171
/// Iterators obtained from functions such as [`BTreeMap::iter`], [`BTreeMap::values`], or
7272
/// [`BTreeMap::keys`] produce their items in order by key, and take worst-case logarithmic and

Diff for: library/alloc/src/collections/btree/set.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ use super::Recover;
2323
/// It is a logic error for an item to be modified in such a way that the item's ordering relative
2424
/// to any other item, as determined by the [`Ord`] trait, changes while it is in the set. This is
2525
/// normally only possible through [`Cell`], [`RefCell`], global state, I/O, or unsafe code.
26-
/// The behavior resulting from such a logic error is not specified (it could include panics,
27-
/// incorrect results, aborts, memory leaks, or non-termination) but will not be undefined
28-
/// behavior.
26+
/// The behavior resulting from such a logic error is not specified, but will be encapsulated to the
27+
/// `BTreeSet` that observed the logic error and not result in undefined behavior. This could
28+
/// include panics, incorrect results, aborts, memory leaks, and non-termination.
2929
///
3030
/// Iterators returned by [`BTreeSet::iter`] produce their items in order, and take worst-case
3131
/// logarithmic and amortized constant time per item returned.

Diff for: library/alloc/src/vec/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2472,7 +2472,7 @@ impl<T: Copy, A: Allocator> ExtendFromWithinSpec for Vec<T, A> {
24722472
// SAFETY:
24732473
// - Both pointers are created from unique slice references (`&mut [_]`)
24742474
// so they are valid and do not overlap.
2475-
// - Elements are :Copy so it's OK to to copy them, without doing
2475+
// - Elements are :Copy so it's OK to copy them, without doing
24762476
// anything with the original values
24772477
// - `count` is equal to the len of `source`, so source is valid for
24782478
// `count` reads

Diff for: library/core/src/slice/raw.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ pub const unsafe fn from_ptr_range<'a, T>(range: Range<*const T>) -> &'a [T] {
264264
///
265265
/// [valid]: ptr#safety
266266
#[unstable(feature = "slice_from_ptr_range", issue = "89792")]
267-
#[rustc_const_unstable(feature = "slice_from_mut_ptr_range_const", issue = "89792")]
267+
#[rustc_const_unstable(feature = "const_slice_from_mut_ptr_range", issue = "89792")]
268268
pub const unsafe fn from_mut_ptr_range<'a, T>(range: Range<*mut T>) -> &'a mut [T] {
269269
// SAFETY: the caller must uphold the safety contract for `from_mut_ptr_range`.
270270
unsafe { from_raw_parts_mut(range.start, range.end.sub_ptr(range.start)) }

Diff for: library/std/src/collections/hash/map.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ use crate::sys;
5454
/// the [`Eq`] trait, changes while it is in the map. This is normally only
5555
/// possible through [`Cell`], [`RefCell`], global state, I/O, or unsafe code.
5656
/// The behavior resulting from such a logic error is not specified, but will
57-
/// not result in undefined behavior. This could include panics, incorrect results,
57+
/// be encapsulated to the `HashMap` that observed the logic error and not
58+
/// result in undefined behavior. This could include panics, incorrect results,
5859
/// aborts, memory leaks, and non-termination.
5960
///
6061
/// The hash table implementation is a Rust port of Google's [SwissTable].

Diff for: library/std/src/collections/hash/set.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ use super::map::{map_try_reserve_error, RandomState};
3333
/// In other words, if two keys are equal, their hashes must be equal.
3434
///
3535
///
36-
/// It is a logic error for an item to be modified in such a way that the
37-
/// item's hash, as determined by the [`Hash`] trait, or its equality, as
38-
/// determined by the [`Eq`] trait, changes while it is in the set. This is
39-
/// normally only possible through [`Cell`], [`RefCell`], global state, I/O, or
40-
/// unsafe code. The behavior resulting from such a logic error is not
41-
/// specified (it could include panics, incorrect results, aborts, memory
42-
/// leaks, or non-termination) but will not be undefined behavior.
36+
/// It is a logic error for a key to be modified in such a way that the key's
37+
/// hash, as determined by the [`Hash`] trait, or its equality, as determined by
38+
/// the [`Eq`] trait, changes while it is in the map. This is normally only
39+
/// possible through [`Cell`], [`RefCell`], global state, I/O, or unsafe code.
40+
/// The behavior resulting from such a logic error is not specified, but will
41+
/// be encapsulated to the `HashSet` that observed the logic error and not
42+
/// result in undefined behavior. This could include panics, incorrect results,
43+
/// aborts, memory leaks, and non-termination.
4344
///
4445
/// # Examples
4546
///

Diff for: src/tools/rust-analyzer

0 commit comments

Comments
 (0)