File tree 2 files changed +10
-2
lines changed
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ impl GuaranteeLifetimeContext {
93
93
let omit_root = (
94
94
ptr_mutbl == m_imm &&
95
95
self . bccx . is_subregion_of ( self . loan_region , base_scope) &&
96
- base . mutbl . is_immutable ( ) &&
96
+ self . is_rvalue_or_immutable ( base ) &&
97
97
!self . is_moved ( base)
98
98
) ;
99
99
@@ -168,6 +168,14 @@ impl GuaranteeLifetimeContext {
168
168
}
169
169
}
170
170
171
+ fn is_rvalue_or_immutable ( & self ,
172
+ cmt : mc:: cmt ) -> bool {
173
+ cmt. mutbl . is_immutable ( ) || match cmt. guarantor ( ) . cat {
174
+ mc:: cat_rvalue => true ,
175
+ _ => false
176
+ }
177
+ }
178
+
171
179
fn check_root ( & self ,
172
180
cmt_deref : mc:: cmt ,
173
181
cmt_base : mc:: cmt ,
Original file line number Diff line number Diff line change @@ -551,7 +551,7 @@ pub impl mem_categorization_ctxt {
551
551
id : elt. id ( ) ,
552
552
span : elt. span ( ) ,
553
553
cat : cat_rvalue,
554
- mutbl : McImmutable ,
554
+ mutbl : McDeclared ,
555
555
ty : expr_ty
556
556
}
557
557
}
You can’t perform that action at this time.
0 commit comments