File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
compiler/rustc_middle/src/mir Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -190,7 +190,7 @@ pub enum BorrowKind {
190190#[ derive( Hash , HashStable ) ]
191191pub enum MutBorrowKind {
192192 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`)
194194 TwoPhaseBorrow ,
195195 /// Data must be immutable but not aliasable. This kind of borrow
196196 /// cannot currently be expressed by the user and is used only in
@@ -226,9 +226,12 @@ pub enum MutBorrowKind {
226226 /// user code, if awkward, but extra weird for closures, since the
227227 /// borrow is hidden.
228228 ///
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
232235 /// borrow, it's just used when translating closures.
233236 ClosureCapture ,
234237}
You can’t perform that action at this time.
0 commit comments