-Zprint-type-sizes: print the types of awaitees and unnamed coroutine locals. by kpreid · Pull Request #122922 · rust-lang/rust (original) (raw)

This should assist comprehending the size of coroutines. In particular, whenever a future is suspended while awaiting another future, the latter is given the special name __awaitee, and now the type of the awaited future will be printed, allowing identifying caller/callee — er, I mean, poller/pollee — relationships.

It would be possible to include the type name in more cases, but I thought that that might be overly verbose (print-type-sizes is already a lot of text) and ordinary named fields or variables are easier for readers to discover the types of.

This change will also synergize with my other PR #122923 which changes type printing to print the path of the async fn instead of the span.

Implementation note: I'm not sure if Symbol::intern is appropriate for this application, but it was the obvious way to not have to remove the Copy implementation from FieldInfo, or add a 'tcx lifetime, while avoiding keeping a lot of possibly redundant strings in memory. I don't know what the proper tradeoff to make here is (though presumably it is not too important for a -Z debugging option).