rust-lang / rust-lang/reference
unique-immutable-borrows is a misnomer and no longer exists in rustc
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 607
- PR merge metrics
- PR metrics pending
Description
https://doc.rust-lang.org/nightly/reference/types/closure.html#unique-immutable-borrows-in-captures
This borrow kind exists to support capturing let x = &mut whatever and mutating through x without triggering the non-soundness critical "missing mut binding" error.
Stating that it's immutable is wrong and for rustc itself, has been actively dangerous: https://github.com/rust-lang/rust/issues/112056
We've since removed this borrow kind in rustc itself: https://github.com/rust-lang/rust/pull/112119. I am not totally sure how to rework this, but "unique immutable" is imo definitely the wrong perspective
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Reference section on unique immutable borrows in closure captures and read rust-lang/rust issues #112056 and pull request #112119 for the rustc context. Rework the terminology and explanation so it no longer describes the borrow as immutable and matches the current rustc behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100