Auto merge of #85020 - lrh2000:named-upvars, r=tmandry
Name the captured upvars for closures/generators in debuginfo Previously, debuggers print closures as something like ``` y::main::closure-0 (0x7fffffffdd34) ``` The pointer actually references to an upvar. It is not very obvious, especially for beginners. It's because upvars don't have names before, as they are packed into a tuple. This PR names the upvars, so we can expect to see something like ``` y::main::closure-0 {_captured_ref__b: 0x[...]} ``` r? `@tmandry` Discussed at https://github.com/rust-lang/rust/pull/84752#issuecomment-831639489 .
This commit is contained in:
commit
99efc51dae
9 changed files with 276 additions and 23 deletions
|
@ -342,6 +342,16 @@ rustc_queries! {
|
|||
}
|
||||
}
|
||||
|
||||
query symbols_for_closure_captures(
|
||||
key: (LocalDefId, DefId)
|
||||
) -> Vec<rustc_span::Symbol> {
|
||||
desc {
|
||||
|tcx| "symbols for captures of closure `{}` in `{}`",
|
||||
tcx.def_path_str(key.1),
|
||||
tcx.def_path_str(key.0.to_def_id())
|
||||
}
|
||||
}
|
||||
|
||||
/// MIR after our optimization passes have run. This is MIR that is ready
|
||||
/// for codegen. This is also the only query that can fetch non-local MIR, at present.
|
||||
query optimized_mir(key: DefId) -> &'tcx mir::Body<'tcx> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue