@@ -263,14 +263,13 @@ impl<'tcx> Stack {
263
263
. rev ( ) // search top-to-bottom
264
264
// Return permission of first item that grants access.
265
265
// We require a permission with the right tag, ensuring U3 and F3.
266
- . filter_map ( |( idx, item) |
266
+ . find_map ( |( idx, item) |
267
267
if item. perm . grants ( access) && tag == item. tag {
268
268
Some ( ( idx, item. perm ) )
269
269
} else {
270
270
None
271
271
}
272
272
)
273
- . next ( )
274
273
}
275
274
276
275
/// Test if a memory `access` using pointer tagged `tag` is granted.
@@ -286,8 +285,8 @@ impl<'tcx> Stack {
286
285
// Step 1: Find granting item.
287
286
let ( granting_idx, granting_perm) = self . find_granting ( access, tag)
288
287
. ok_or_else ( || InterpError :: MachineError ( format ! (
289
- "no item granting {} access to tag {} found in borrow stack" ,
290
- access, tag,
288
+ "no item granting {} access to tag {} found in borrow stack" ,
289
+ access, tag,
291
290
) ) ) ?;
292
291
293
292
// Step 2: Remove everything incompatible above them. Make sure we do not remove protected
@@ -313,9 +312,9 @@ impl<'tcx> Stack {
313
312
if let Some ( call) = item. protector {
314
313
if global. is_active ( call) {
315
314
return err ! ( MachineError ( format!(
316
- "not granting {} access to tag {} because incompatible item {} is protected" ,
317
- access, tag, item
318
- ) ) ) ;
315
+ "not granting {} access to tag {} because incompatible item {} is protected" ,
316
+ access, tag, item
317
+ ) ) ) ;
319
318
}
320
319
}
321
320
trace ! ( "access: removing item {}" , item) ;
@@ -337,8 +336,8 @@ impl<'tcx> Stack {
337
336
// Step 1: Find granting item.
338
337
self . find_granting ( AccessKind :: Write , tag)
339
338
. ok_or_else ( || InterpError :: MachineError ( format ! (
340
- "no item granting write access for deallocation to tag {} found in borrow stack" ,
341
- tag,
339
+ "no item granting write access for deallocation to tag {} found in borrow stack" ,
340
+ tag,
342
341
) ) ) ?;
343
342
344
343
// We must make sure there are no protected items remaining on the stack.
@@ -386,10 +385,10 @@ impl<'tcx> Stack {
386
385
) -> EvalResult < ' tcx > {
387
386
// Figure out which access `perm` corresponds to.
388
387
let access = if new. perm . grants ( AccessKind :: Write ) {
389
- AccessKind :: Write
390
- } else {
391
- AccessKind :: Read
392
- } ;
388
+ AccessKind :: Write
389
+ } else {
390
+ AccessKind :: Read
391
+ } ;
393
392
// Now we figure out which item grants our parent (`derived_from`) this kind of access.
394
393
// We use that to determine where to put the new item.
395
394
let ( derived_from_idx, _) = self . find_granting ( access, derived_from)
0 commit comments