Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mir: begin documenting user variable debuginfo. #571

Merged
merged 1 commit into from
Feb 5, 2020

Conversation

eddyb
Copy link
Member

@eddyb eddyb commented Feb 3, 2020

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 a debug inside, no lets), with the example in rust-lang/rust#56231.

r? @nikomatsakis cc @rust-lang/wg-mir-opt

@spastorino
Copy link
Member

@eddyb cool, I was wondering if something could also be documented on rustc-guide :).

@nikomatsakis
Copy link
Contributor

@eddyb you are my hero

Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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));`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but it feels like this introduction to MIR is trying to stay light, and that makes it awkward to go into details.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@nikomatsakis nikomatsakis merged commit e69b987 into rust-lang:master Feb 5, 2020
@eddyb eddyb deleted the mir-var-debuginfo branch February 6, 2020 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants