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

Implement richer debug information for ProjectionElem #53

Open
klinvill opened this issue Nov 15, 2023 · 5 comments
Open

Implement richer debug information for ProjectionElem #53

klinvill opened this issue Nov 15, 2023 · 5 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@klinvill
Copy link

klinvill commented Nov 15, 2023

Similar to what Oğuz did in rust-lang/rust#115534, indexed types should have debug methods that prints out more useful information like the name of the definition/variant/field.

As mentioned in rust-lang/rust#117517 (comment), this kind of debug printing is likely not possible for ProjectionElem until AdtDef is implemented in Stable MIR. Place::ty may also need to be implemented first to easily resolve the name of a variant/field. This is because it may be easiest to create a copy of the Place definition with the projection elements truncated to either the desired Downcast/Field projection or its parent, and then just call the Place::ty function to get the appropriate AdtDef.

@celinval
Copy link
Contributor

celinval commented Jan 4, 2024

I believe this issue is unblocked now sice we have implemented AdtDef and Place::ty(). @klinvill, any thoughts?

@celinval celinval added the good first issue Good for newcomers label Jan 4, 2024
@klinvill
Copy link
Author

Yeah I think it should be unblocked now. I unfortunately have a few other things on my plate to take care of first, but ideally can take a stab at this in the next couple of weeks.

@m-rph
Copy link

m-rph commented Mar 1, 2024

@rustbot claim

@m-rph
Copy link

m-rph commented Mar 5, 2024

This looks simple enough, unless I am missing something it's just a matter of adding all the variants of the enum, no?

@m-rph
Copy link

m-rph commented Mar 9, 2024

Okay, it seems that I am missing something, I can't see how the implementation of Place:ty can be used to retrieve the parent of an element. If all you have is local information, e.g. source relative index as in Downcast, how can Place::ty be used to retrieve the parent ADT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants