about summary refs log tree commit diff
path: root/compiler/rustc_interface/src
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-04-09 20:23:09 +0200
committerGitHub <noreply@github.com>2025-04-09 20:23:09 +0200
commitd5f930fe76ab17ad5ccd4834f3cea10a99022cf2 (patch)
treee214844f9b96ecbdde35edc8869fe56ce9363cae /compiler/rustc_interface/src
parent3507f359b1167e90b6d447cb7add6890c7e6b0dc (diff)
parent0162f29436d7992ca5f3b642a282045afd922a26 (diff)
downloadrust-d5f930fe76ab17ad5ccd4834f3cea10a99022cf2.tar.gz
rust-d5f930fe76ab17ad5ccd4834f3cea10a99022cf2.zip
Rollup merge of #139164 - xizheyin:issue-139034, r=joboet
std: improve documentation for get_mut() methods regarding forgotten guards

Fixes #139034

This PR improves the documentation for `get_mut()` methods in `Mutex`, `RefCell`, and `RwLock` to clarify their behavior when lock guards are forgotten (e.g., via std::mem::forget).

The current documentation for these methods states that a mutable borrow "statically guarantees no locks exist", which is not entirely accurate. While a mutable borrow prevents new locks from being created, it does not clear or detect previously abandoned locks through `forget()`. This can lead to counterintuitive behavior:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=e68cefec12dcd435daf2237c16824ed3
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=81263ad652c752afd63c903113d3082c
https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=311baa4edb3abf82a25c8d7bf21a4a52

r? libs
Diffstat (limited to 'compiler/rustc_interface/src')
0 files changed, 0 insertions, 0 deletions