- if granting_perm.compatible_with(access, *item) {
- // Keep this, check next.
- cur += 1;
- } else {
- // Aha! This is a bad one, remove it, and if it is an *active* barrier
- // we have a problem.
- match self.borrows.remove(cur) {
- Item::FnBarrier(call) if global.is_active(call) => {
+ match *item {
+ Item::Permission(perm, _) => {
+ if granting_perm.compatible_with(access, perm) {
+ // Keep this, check next.
+ cur += 1;
+ } else {
+ // Aha! This is a bad one, remove it.
+ let item = self.borrows.remove(cur);
+ trace!("access: popping item {}", item);
+ removed_item = Some(item);
+ }
+ }
+ Item::FnBarrier(call) if !global.is_active(call) => {
+ // An inactive barrier, just get rid of it. (Housekeeping.)
+ self.borrows.remove(cur);
+ }
+ Item::FnBarrier(call) => {
+ // We hit an active barrier! If we have already removed an item,
+ // we got a problem! The barrier was supposed to protect this item.
+ if let Some(removed_item) = removed_item {