This might be a nice generic tool to have; something that lets you do RefCell
-like runtime borrow checking but applying to normal references (when used by functions) rather than a distinct type. Note that it still has to use the same callback_scope(|ctx| {...})
style mechanism to establish the scope; this would just make it separate from the types it's being used with.
Caveat: Rust code currently can't be generic over function arity, which makes it less convenient (or more work for this hypothetical generic library) if the callback you want to "weaken" is expected to have more than one.