-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
merge BorrowKind::Unique
into BorrowKind::Mut
#112072
Comments
Can |
afaict it is only used to deal with locals whose type is |
…r=oli-obk change `BorrowKind::Unique` to be a mutating `PlaceContext` fixes rust-lang#112056 I believe that `BorrowKind::Unique` is a footgun in general, so I added a FIXME and opened rust-lang#112072. This is a bit too involved for this PR though.
…oli-obk change `BorrowKind::Unique` to be a mutating `PlaceContext` fixes rust-lang#112056 I believe that `BorrowKind::Unique` is a footgun in general, so I added a FIXME and opened rust-lang#112072. This is a bit too involved for this PR though.
change `BorrowKind::Unique` to be a mutating `PlaceContext` fixes #112056 I believe that `BorrowKind::Unique` is a footgun in general, so I added a FIXME and opened rust-lang/rust#112072. This is a bit too involved for this PR though.
We currently have a separate
mir::BorrowKind
for the mutable borrows for closure upvars.BorrowKind::Unique
is an ordinary mutable borrow, requiring its target to be invariant, needing unique access, except that the target is not necessarily required to be marked asmut
by the user.We should merge this into
BorrowKind::Mut
, resulting in the following setup:It is quite worrying to me that
fn BorrowKind::mutability
simply returnsMutability::Not
forBorrowKind::Unique
rust/compiler/rustc_middle/src/mir/mod.rs
Lines 2030 to 2035 in 99ff5af
This already caused a bug in #112056 where we used
PlaceContext::NonMutatingUse
for unique borrows, which resulted in us getting the wrong variance, cc #112070.The text was updated successfully, but these errors were encountered: