File tree 1 file changed +7
-4
lines changed
compiler/rustc_middle/src/mir
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -190,7 +190,7 @@ pub enum BorrowKind {
190
190
#[ derive( Hash , HashStable ) ]
191
191
pub enum MutBorrowKind {
192
192
Default ,
193
- /// this borrow arose from method-call auto-ref. (i.e., `adjustment::Adjust::Borrow`)
193
+ /// This borrow arose from method-call auto-ref. (i.e., `adjustment::Adjust::Borrow`)
194
194
TwoPhaseBorrow ,
195
195
/// Data must be immutable but not aliasable. This kind of borrow
196
196
/// cannot currently be expressed by the user and is used only in
@@ -226,9 +226,12 @@ pub enum MutBorrowKind {
226
226
/// user code, if awkward, but extra weird for closures, since the
227
227
/// borrow is hidden.
228
228
///
229
- /// So we introduce a "unique imm" borrow -- the referent is
230
- /// immutable, but not aliasable. This solves the problem. For
231
- /// simplicity, we don't give users the way to express this
229
+ /// So we introduce a `ClosureCapture` borrow -- user will not have to mark the variable
230
+ /// containing the mutable reference as `mut`, as they didn't ever
231
+ /// intend to mutate the mutable reference itself. We still mutable capture it in order to
232
+ /// mutate the pointed value through it (but not mutating the reference itself).
233
+ ///
234
+ /// This solves the problem. For simplicity, we don't give users the way to express this
232
235
/// borrow, it's just used when translating closures.
233
236
ClosureCapture ,
234
237
}
You can’t perform that action at this time.
0 commit comments