]> git.lizzy.rs Git - rust.git/commit - src/tools/miri
Auto merge of #85020 - lrh2000:named-upvars, r=tmandry
authorbors <bors@rust-lang.org>
Sat, 14 Aug 2021 07:01:36 +0000 (07:01 +0000)
committerbors <bors@rust-lang.org>
Sat, 14 Aug 2021 07:01:36 +0000 (07:01 +0000)
commit99efc51dae1dbe9d741707a7ddef84c29e654df5
tree19a98d216296a5b00b034678949d238b62bcb004
parentc6094fc7b9981d755abeb8c0e866a0f6315b3ec3
parentcf5eda1b4d24d508039e96d939043268e955af6f
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 .
compiler/rustc_middle/src/query/mod.rs
compiler/rustc_middle/src/ty/closure.rs
compiler/rustc_middle/src/ty/mod.rs
compiler/rustc_mir_build/src/build/mod.rs