@@ -5,15 +5,14 @@ use super::{
5
5
BlockedNode , BorrowPCGEdge , BorrowPCGEdgeLike , BorrowPCGEdgeRef , LocalNode , ToBorrowsEdge ,
6
6
} ,
7
7
coupling_graph_constructor:: BorrowCheckerInterface ,
8
- edge:: kind:: BorrowPCGEdgeKind ,
9
8
graph:: { BorrowsGraph , FrozenGraphRef } ,
10
9
latest:: Latest ,
11
10
path_condition:: { PathCondition , PathConditions } ,
12
11
} ;
13
- use crate :: borrow_pcg:: edge:: borrow:: BorrowEdge ;
14
12
use crate :: utils:: place:: maybe_old:: MaybeOldPlace ;
15
13
use crate :: utils:: place:: maybe_remote:: MaybeRemotePlace ;
16
14
use crate :: { borrow_pcg:: action:: executed_actions:: ExecutedActions , combined_pcs:: PCGError } ;
15
+ use crate :: borrow_pcg:: edge:: borrow:: BorrowEdge ;
17
16
use crate :: {
18
17
borrow_pcg:: edge_data:: EdgeData ,
19
18
combined_pcs:: { PCGNode , PCGNodeLike } ,
@@ -236,21 +235,6 @@ impl<'tcx> BorrowsState<'tcx> {
236
235
changed
237
236
}
238
237
239
- fn min_blocked_by_capability (
240
- & self ,
241
- edge : & BorrowPCGEdgeKind < ' tcx > ,
242
- repacker : PlaceRepacker < ' _ , ' tcx > ,
243
- ) -> Option < CapabilityKind > {
244
- let mut iter = edge. blocked_by_nodes ( repacker) . into_iter ( ) ;
245
- let first_node = iter. next ( ) ?;
246
- let mut cap = self . get_capability ( first_node. into ( ) ) ?;
247
- for node in iter {
248
- let other_cap = self . get_capability ( node. into ( ) ) ?;
249
- cap = cap. minimum ( other_cap) ?;
250
- }
251
- Some ( cap)
252
- }
253
-
254
238
pub ( super ) fn remove_edge_and_set_latest (
255
239
& mut self ,
256
240
edge : impl BorrowPCGEdgeLike < ' tcx > ,
@@ -286,16 +270,18 @@ impl<'tcx> BorrowsState<'tcx> {
286
270
if let Some ( local_node) = node. as_local_node ( repacker) {
287
271
let blocked_cap = self . get_capability ( node) ;
288
272
289
- let restore_cap = self . min_blocked_by_capability ( edge. kind ( ) , repacker) ;
273
+ let restore_cap = if local_node. place ( ) . projects_shared_ref ( repacker) {
274
+ CapabilityKind :: Read
275
+ } else {
276
+ CapabilityKind :: Exclusive
277
+ } ;
290
278
291
- if let Some ( restore_cap) = restore_cap {
292
- if blocked_cap. is_none_or ( |bc| bc < restore_cap) {
293
- self . record_and_apply_action (
294
- BorrowPCGAction :: restore_capability ( local_node, restore_cap) ,
295
- & mut actions,
296
- repacker,
297
- ) ?;
298
- }
279
+ if blocked_cap. is_none_or ( |bc| bc < restore_cap) {
280
+ self . record_and_apply_action (
281
+ BorrowPCGAction :: restore_capability ( local_node, restore_cap) ,
282
+ & mut actions,
283
+ repacker,
284
+ ) ?;
299
285
}
300
286
}
301
287
}
@@ -493,7 +479,7 @@ impl<'tcx> BorrowsState<'tcx> {
493
479
BorrowKind :: Mut {
494
480
kind : MutBorrowKind :: Default ,
495
481
} => {
496
- self . remove_capability ( blocked_place. into ( ) ) ;
482
+ let _ = self . remove_capability ( blocked_place. into ( ) ) ;
497
483
}
498
484
_ => {
499
485
match self . get_capability ( blocked_place. into ( ) ) {
0 commit comments