Skip to content

Commit 1e4dce6

Browse files
committed
Auto merge of rust-lang#139595 - matthiaskrgr:rollup-kaa8aim, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - rust-lang#138470 (Test interaction between RFC 2229 migration and use closures) - rust-lang#138628 (Add more ergonomic clone tests) - rust-lang#139164 (std: improve documentation for get_mut() methods regarding forgotten guards) - rust-lang#139488 (Add missing regression GUI test) - rust-lang#139489 (compiletest: Add directive `dont-require-annotations`) - rust-lang#139513 (Report higher-ranked trait error when higher-ranked projection goal fails in new solver) - rust-lang#139521 (triagebot: roll compiler reviewers for rustc/unstable book) - rust-lang#139532 (Update `u8`-to-and-from-`i8` suggestions.) - rust-lang#139551 (report call site of inlined scopes for large assignment lints) - rust-lang#139575 (Remove redundant words) r? `@ghost` `@rustbot` modify labels: rollup
2 parents b672b1d + a7ba49a commit 1e4dce6

File tree

5 files changed

+16
-6
lines changed

5 files changed

+16
-6
lines changed

core/src/cell.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,9 @@ impl<T: ?Sized> RefCell<T> {
11561156
/// Since this method borrows `RefCell` mutably, it is statically guaranteed
11571157
/// that no borrows to the underlying data exist. The dynamic checks inherent
11581158
/// in [`borrow_mut`] and most other methods of `RefCell` are therefore
1159-
/// unnecessary.
1159+
/// unnecessary. Note that this method does not reset the borrowing state if borrows were previously leaked
1160+
/// (e.g., via [`forget()`] on a [`Ref`] or [`RefMut`]). For that purpose,
1161+
/// consider using the unstable [`undo_leak`] method.
11601162
///
11611163
/// This method can only be called if `RefCell` can be mutably borrowed,
11621164
/// which in general is only the case directly after the `RefCell` has
@@ -1167,6 +1169,8 @@ impl<T: ?Sized> RefCell<T> {
11671169
/// Use [`borrow_mut`] to get mutable access to the underlying data then.
11681170
///
11691171
/// [`borrow_mut`]: RefCell::borrow_mut()
1172+
/// [`forget()`]: mem::forget
1173+
/// [`undo_leak`]: RefCell::undo_leak()
11701174
///
11711175
/// # Examples
11721176
///

core/src/clone.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ pub unsafe trait CloneToUninit {
427427
/// read or dropped, because even if it was previously valid, it may have been partially
428428
/// overwritten.
429429
///
430-
/// The caller may wish to to take care to deallocate the allocation pointed to by `dest`,
430+
/// The caller may wish to take care to deallocate the allocation pointed to by `dest`,
431431
/// if applicable, to avoid a memory leak (but this is not a requirement).
432432
///
433433
/// Implementors should avoid leaking values by, upon unwinding, dropping all component values

core/src/num/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ macro_rules! i8_xe_bytes_doc {
9999
100100
**Note**: This function is meaningless on `i8`. Byte order does not exist as a
101101
concept for byte-sized integers. This function is only provided in symmetry
102-
with larger integer types. You can cast from and to `u8` using `as i8` and `as
103-
u8`.
102+
with larger integer types. You can cast from and to `u8` using
103+
[`cast_signed`](u8::cast_signed) and [`cast_unsigned`](Self::cast_unsigned).
104104
105105
"
106106
};

std/src/sync/poison/mutex.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,9 @@ impl<T: ?Sized> Mutex<T> {
582582
/// Returns a mutable reference to the underlying data.
583583
///
584584
/// Since this call borrows the `Mutex` mutably, no actual locking needs to
585-
/// take place -- the mutable borrow statically guarantees no locks exist.
585+
/// take place -- the mutable borrow statically guarantees no new locks can be acquired
586+
/// while this reference exists. Note that this method does not clear any previous abandoned locks
587+
/// (e.g., via [`forget()`] on a [`MutexGuard`]).
586588
///
587589
/// # Errors
588590
///
@@ -599,6 +601,8 @@ impl<T: ?Sized> Mutex<T> {
599601
/// *mutex.get_mut().unwrap() = 10;
600602
/// assert_eq!(*mutex.lock().unwrap(), 10);
601603
/// ```
604+
///
605+
/// [`forget()`]: mem::forget
602606
#[stable(feature = "mutex_get_mut", since = "1.6.0")]
603607
pub fn get_mut(&mut self) -> LockResult<&mut T> {
604608
let data = self.data.get_mut();

std/src/sync/poison/rwlock.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,9 @@ impl<T: ?Sized> RwLock<T> {
608608
/// Returns a mutable reference to the underlying data.
609609
///
610610
/// Since this call borrows the `RwLock` mutably, no actual locking needs to
611-
/// take place -- the mutable borrow statically guarantees no locks exist.
611+
/// take place -- the mutable borrow statically guarantees no new locks can be acquired
612+
/// while this reference exists. Note that this method does not clear any previously abandoned locks
613+
/// (e.g., via [`forget()`] on a [`RwLockReadGuard`] or [`RwLockWriteGuard`]).
612614
///
613615
/// # Errors
614616
///

0 commit comments

Comments
 (0)