Desugaring of closures

⚓ Rust    📅 2025-10-29    👤 surdeus    👁️ 6      

surdeus

Warning

This post was published 34 days ago. The information described in this article may have changed.

Info

This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Desugaring of closures

Hi 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

Read full topic

🏷️ Rust_feed