diff --git a/hir-place-target.md b/hir-place-target.md index 493fa3b..bdad96a 100644 --- a/hir-place-target.md +++ b/hir-place-target.md @@ -1,16 +1,16 @@ -We are going to be refactoring [HIR places] to capture sufficient detail for us to use them to describe the places that a closure captures. +We are going to be refactoring [HIR places] to capture sufficient detail for us to use them to describe the places that a closure captures. The expected target structure looks something like this: ```rust /// A reference to a particular place that appears in the source code -struct PlaceReference<'tcx> { +struct PlaceWithHirId<'tcx> { /// the place being referenced place: Place<'tcx>, - + /// hir-id of source expression or pattern hir_id: HirId, - + // Maybe no Span, since they're being removed from the Hir } @@ -19,38 +19,41 @@ struct PlaceReference<'tcx> { struct Place<'tcx> { /// start of the place expression, typically a local variable base: PlaceBase, - - /// projections select parts of the base expression; e.g., + + /// Type of the Base + base_ty: Ty<'tcx>, + + /// projections select parts of the base expression; e.g., /// in the place expression `a.b.c`, `b` and `c` are projections projections: Vec>, } -/// *Projections* select parts of the base expression; e.g., +/// *Projections* select parts of the base expression; e.g., /// in the place expression `a.b.c`, `b` and `c` are projections struct Projection<'tcx> { - /// Type of the projection thus far. - ty: Ty<'tcx>, - - /// + /// type of the projection. kind: ProjectionKind, + + /// Type after the projection is applied. + after_ty: Ty<'tcx>, } /// Kinds of projections enum ProjectionKind { /// `*B`, where `B` is the base expression Deref, - + /// `B.F` where `B` is the base expression and `F` is /// the field. The field is identified by which variant /// it appears in along with a field index. The variant /// is used for enums. Field(Field, VariantIdx), - + /// Some index like `B[x]`, where `B` is the base /// expression. We don't preserve the index `x` because /// we won't need it. Index, - + /// A subslice covering a range of values like `B[x..y]`. Subslice, }