Skip to content

unique-immutable-borrows is a misnomer and no longer exists in rustc #1959

@lcnr

Description

@lcnr

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: rust-lang/rust#112056

We've since removed this borrow kind in rustc itself: rust-lang/rust#112119. I am not totally sure how to rework this, but "unique immutable" is imo definitely the wrong perspective

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions