This repository was archived by the owner on Apr 5, 2024. It is now read-only.
This repository was archived by the owner on Apr 5, 2024. It is now read-only.
Store Type Information within projections #5
Closed
Description
Currently within hir::Place
type information is only stored for the final value/memory being read.
Type information at each intermediate access can be useful later and computing this information again at each Projection could be complicated and costly.
The final structure is explained here:
https://github.com/rust-lang/project-rfc-2229/blob/master/hir-place-target.md
Projection is defined here: https://github.com/rust-lang/rust/blob/master/src/librustc_typeck/mem_categorization.rs#L77
Based on discussion on Zulip we also want the following to close this issue
- Remove current type from Place
- Add Place::base_ty -- Type information of PlaceBase
- Extending Projection with type information. Provide interface to read ty before and after the projection is applied.
- Removing ProjectionKind::Deref 's type
- Associating PlaceBase::Rvalue with expression hir_id ? (This one is optional for now and can be refactored later, if required.)