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

Update MIR Place description #1387

Closed
pierwill opened this issue Jul 8, 2022 · 5 comments · Fixed by #1632
Closed

Update MIR Place description #1387

pierwill opened this issue Jul 8, 2022 · 5 comments · Fixed by #1632
Labels
Easy Might be a good place for a beginner

Comments

@pierwill
Copy link
Member

pierwill commented Jul 8, 2022

It looks like this is out-of-date, since Place is a struct, not an enum.

- **Places** are identified by the enum [`Place`]. There are a few
variants:
- Local variables like `_1`
- Static variables `FOO`
- **Projections**, which are fields or other things that "project
out" from a base place. These are represented by the type
[`ProjectionElem`]. So e.g. the place `_1.f` is a projection,
with `f` being the "projection element" and `_1` being the base
path. `*_1` is also a projection, with the `*` being represented
by the [`ProjectionElem::Deref`] element.

@pierwill pierwill added the Easy Might be a good place for a beginner label Jul 8, 2022
@tshepang
Copy link
Member

@spastorino this is something you worked on... would update it, but am not familiar enough

@spastorino
Copy link
Member

Yes Place was an enum and if I'm not wrong I've changed it a long while ago to be an struct. By looking at the source code is still a struct https://github.com/rust-lang/rust/blob/7e54847de328a7346c588720f616bf1fcdf609d5/compiler/rustc_middle/src/mir/syntax.rs#L792-L797 so we can update this section of the guide yeah.

@tshepang
Copy link
Member

tshepang commented Jul 18, 2022

@spastorino is the description (the 3 bullet points) still accurate

@spastorino
Copy link
Member

It seems to me that things have changed a bit since I've last checked it. I don't think statics are handled through it, I'd change the more abstract ProjectionElem to PlaceElem and I don't think Deref is handled through it anymore neither. To be honest, I didn't check the code to say what I'm saying, I'm kind of playing by ear.

cc @oli-obk

@oli-obk
Copy link
Contributor

oli-obk commented Jul 19, 2022

other than that Deref still exists (it's in the process of being removed), everything you said is correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Easy Might be a good place for a beginner
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants