Desugaring of closures
⚓ Rust 📅 2025-10-29 👤 surdeus 👁️ 6Hi everyone,
does anyone know a good method for desugaring closures (|| { ... })? The best solution I've found so far is rustc +nightly -Zunpretty=mir, but that's not ideal in my opinion, especially since the value names are already removed. I'm asking because I've been having several nasty problems with the capturing from closures lately. When things like implicit reborrowing, implicit deref coercion, variance stuff due to the receiver of the method of the Fn trait the compiler chooses etc. occur it's often very difficult to figure out exactly what's going on.
EDIT: I just found this comment from @quinedot. #[rustc_capture_analysis] is a very great help!
Regards
keks
2 posts - 2 participants
🏷️ Rust_feed