| ▲ | skavi 4 hours ago | |
> Rust closures that capture data are fat pointers { fn, data } This isn’t fully accurate. In your example, `&mut C` actually has the same layout as usize. It’s not a fat pointer. `C` is a concrete type and essentially just an anonymous struct with FnMut implemented for it. You’re probably thinking of `&mut dyn FnMut` which is a fat pointer that pairs a pointer to the data with a pointer to a VTable. So in your specific example, the double indirection is unnecessary. The following passes miri: https://play.rust-lang.org/?version=nightly&mode=debug&editi... (did this on mobile, so please excuse any messiness). | ||