mir: begin documenting user variable debuginfo.#571
mir: begin documenting user variable debuginfo.#571nikomatsakis merged 1 commit intorust-lang:masterfrom
Conversation
|
@eddyb cool, I was wondering if something could also be documented on rustc-guide :). |
|
@eddyb you are my hero |
nikomatsakis
left a comment
There was a problem hiding this comment.
Left a minor nit. I think ideally there would be a subchapter or mir, "debug info", that could give a few more details about how debug info is represented, built, and maintained across optimizations. It might also be worth leaving a few notes about how debug info is converted to LLVM? (Or maybe pointers into the code where it happens?)
| Here the mapping is trivial, but optimizations may complicate the place, | ||
| or lead to multiple user variables sharing the same place. | ||
| Additionally, closure captures are described using the same system, and so | ||
| they're complicated even without optimizations, e.g.: `debug x => (*((*_1).0: &T));`. |
There was a problem hiding this comment.
it would be good, I think, to have some links to the data structures that describe this in the MIR. I dont' thnk we have to go into details, but just a few links would help people know where to get started.
There was a problem hiding this comment.
I agree, but it feels like this introduction to MIR is trying to stay light, and that makes it awkward to go into details.
There was a problem hiding this comment.
yeah, really I think what we need is to add a subsection with more details. For now, I'm going to merge this PR as is.
There was a problem hiding this comment.
MIR feels like it should be a chapter with sections for every part, perhaps including thing like semantic constraints. I don't know why I expected that to already be a thing at first, I guess I haven't kept up with rustc-guide.
This is the companion to rust-lang/rust#56231, which added these separate debuginfo annotations.
I tried to stick in as much information as I could, but the example does not help me - compare its single
scope 1(with only adebuginside, nolets), with the example in rust-lang/rust#56231.r? @nikomatsakis cc @rust-lang/wg-mir-opt