@@ -1914,7 +1914,7 @@ pub enum Place<'tcx> {
19141914 Base ( PlaceBase < ' tcx > ) ,
19151915
19161916 /// projection out of a place (access a field, deref a pointer, etc)
1917- Projection ( Box < PlaceProjection < ' tcx > > ) ,
1917+ Projection ( Box < Projection < ' tcx > > ) ,
19181918}
19191919
19201920#[ derive( Clone , PartialEq , Eq , PartialOrd , Ord , Hash , RustcEncodable , RustcDecodable , HashStable ) ]
@@ -1944,16 +1944,13 @@ impl_stable_hash_for!(struct Static<'tcx> {
19441944 kind
19451945} ) ;
19461946
1947- /// The `Projection` data structure defines things of the form `B.x`
1948- /// or `*B` or `B[index]`. Note that it is parameterized because it is
1949- /// shared between `Constant` and `Place`. See the aliases
1950- /// `PlaceProjection` etc below.
1947+ /// The `Projection` data structure defines things of the form `base.x`, `*b` or `b[index]`.
19511948#[ derive( Clone , Debug , PartialEq , Eq , PartialOrd , Ord ,
19521949 Hash , RustcEncodable , RustcDecodable , HashStable ) ]
1953- pub struct Projection < B , V , T > {
1954- pub base : B ,
1955- pub elem : ProjectionElem < V , T > ,
1956- }
1950+ pub struct Projection < ' tcx > {
1951+ pub base : Place < ' tcx > ,
1952+ pub elem : PlaceElem < ' tcx > ,
1953+ }
19571954
19581955#[ derive( Clone , Debug , PartialEq , Eq , PartialOrd , Ord ,
19591956 Hash , RustcEncodable , RustcDecodable , HashStable ) ]
@@ -1996,10 +1993,6 @@ pub enum ProjectionElem<V, T> {
19961993 Downcast ( Option < Symbol > , VariantIdx ) ,
19971994}
19981995
1999- /// Alias for projections as they appear in places, where the base is a place
2000- /// and the index is a local.
2001- pub type PlaceProjection < ' tcx > = Projection < Place < ' tcx > , Local , Ty < ' tcx > > ;
2002-
20031996/// Alias for projections as they appear in places, where the base is a place
20041997/// and the index is a local.
20051998pub type PlaceElem < ' tcx > = ProjectionElem < Local , Ty < ' tcx > > ;
@@ -2045,7 +2038,7 @@ impl<'tcx> Place<'tcx> {
20452038 }
20462039
20472040 pub fn elem ( self , elem : PlaceElem < ' tcx > ) -> Place < ' tcx > {
2048- Place :: Projection ( Box :: new ( PlaceProjection { base : self , elem } ) )
2041+ Place :: Projection ( Box :: new ( Projection { base : self , elem } ) )
20492042 }
20502043
20512044 /// Finds the innermost `Local` from this `Place`, *if* it is either a local itself or
@@ -2076,22 +2069,22 @@ impl<'tcx> Place<'tcx> {
20762069 }
20772070
20782071 /// Recursively "iterates" over place components, generating a `PlaceBase` and
2079- /// `PlaceProjections ` list and invoking `op` with a `PlaceProjectionsIter `.
2072+ /// `Projections ` list and invoking `op` with a `ProjectionsIter `.
20802073 pub fn iterate < R > (
20812074 & self ,
2082- op : impl FnOnce ( & PlaceBase < ' tcx > , PlaceProjectionsIter < ' _ , ' tcx > ) -> R ,
2075+ op : impl FnOnce ( & PlaceBase < ' tcx > , ProjectionsIter < ' _ , ' tcx > ) -> R ,
20832076 ) -> R {
2084- self . iterate2 ( & PlaceProjections :: Empty , op)
2077+ self . iterate2 ( & Projections :: Empty , op)
20852078 }
20862079
20872080 fn iterate2 < R > (
20882081 & self ,
2089- next : & PlaceProjections < ' _ , ' tcx > ,
2090- op : impl FnOnce ( & PlaceBase < ' tcx > , PlaceProjectionsIter < ' _ , ' tcx > ) -> R ,
2082+ next : & Projections < ' _ , ' tcx > ,
2083+ op : impl FnOnce ( & PlaceBase < ' tcx > , ProjectionsIter < ' _ , ' tcx > ) -> R ,
20912084 ) -> R {
20922085 match self {
20932086 Place :: Projection ( interior) => interior. base . iterate2 (
2094- & PlaceProjections :: List {
2087+ & Projections :: List {
20952088 projection : interior,
20962089 next,
20972090 } ,
@@ -2111,26 +2104,26 @@ impl<'tcx> Place<'tcx> {
21112104/// N.B., this particular impl strategy is not the most obvious. It was
21122105/// chosen because it makes a measurable difference to NLL
21132106/// performance, as this code (`borrow_conflicts_with_place`) is somewhat hot.
2114- pub enum PlaceProjections < ' p , ' tcx : ' p > {
2107+ pub enum Projections < ' p , ' tcx : ' p > {
21152108 Empty ,
21162109
21172110 List {
2118- projection : & ' p PlaceProjection < ' tcx > ,
2119- next : & ' p PlaceProjections < ' p , ' tcx > ,
2111+ projection : & ' p Projection < ' tcx > ,
2112+ next : & ' p Projections < ' p , ' tcx > ,
21202113 }
21212114}
21222115
2123- impl < ' p , ' tcx > PlaceProjections < ' p , ' tcx > {
2124- fn iter ( & self ) -> PlaceProjectionsIter < ' _ , ' tcx > {
2125- PlaceProjectionsIter { value : self }
2116+ impl < ' p , ' tcx > Projections < ' p , ' tcx > {
2117+ fn iter ( & self ) -> ProjectionsIter < ' _ , ' tcx > {
2118+ ProjectionsIter { value : self }
21262119 }
21272120}
21282121
2129- impl < ' p , ' tcx > IntoIterator for & ' p PlaceProjections < ' p , ' tcx > {
2130- type Item = & ' p PlaceProjection < ' tcx > ;
2131- type IntoIter = PlaceProjectionsIter < ' p , ' tcx > ;
2122+ impl < ' p , ' tcx > IntoIterator for & ' p Projections < ' p , ' tcx > {
2123+ type Item = & ' p Projection < ' tcx > ;
2124+ type IntoIter = ProjectionsIter < ' p , ' tcx > ;
21322125
2133- /// Converts a list of `PlaceProjection ` components into an iterator;
2126+ /// Converts a list of `Projection ` components into an iterator;
21342127 /// this iterator yields up a never-ending stream of `Option<&Place>`.
21352128 /// These begin with the "innermost" projection and then with each
21362129 /// projection therefrom. So given a place like `a.b.c` it would
@@ -2144,21 +2137,21 @@ impl<'p, 'tcx> IntoIterator for &'p PlaceProjections<'p, 'tcx> {
21442137 }
21452138}
21462139
2147- /// Iterator over components; see `PlaceProjections ::iter` for more
2140+ /// Iterator over components; see `Projections ::iter` for more
21482141/// information.
21492142///
21502143/// N.B., this is not a *true* Rust iterator -- the code above just
21512144/// manually invokes `next`. This is because we (sometimes) want to
21522145/// keep executing even after `None` has been returned.
2153- pub struct PlaceProjectionsIter < ' p , ' tcx : ' p > {
2154- pub value : & ' p PlaceProjections < ' p , ' tcx > ,
2146+ pub struct ProjectionsIter < ' p , ' tcx : ' p > {
2147+ pub value : & ' p Projections < ' p , ' tcx > ,
21552148}
21562149
2157- impl < ' p , ' tcx > Iterator for PlaceProjectionsIter < ' p , ' tcx > {
2158- type Item = & ' p PlaceProjection < ' tcx > ;
2150+ impl < ' p , ' tcx > Iterator for ProjectionsIter < ' p , ' tcx > {
2151+ type Item = & ' p Projection < ' tcx > ;
21592152
21602153 fn next ( & mut self ) -> Option < Self :: Item > {
2161- if let & PlaceProjections :: List { projection, next } = self . value {
2154+ if let & Projections :: List { projection, next } = self . value {
21622155 self . value = next;
21632156 Some ( projection)
21642157 } else {
@@ -2167,7 +2160,7 @@ impl<'p, 'tcx> Iterator for PlaceProjectionsIter<'p, 'tcx> {
21672160 }
21682161}
21692162
2170- impl < ' p , ' tcx > FusedIterator for PlaceProjectionsIter < ' p , ' tcx > { }
2163+ impl < ' p , ' tcx > FusedIterator for ProjectionsIter < ' p , ' tcx > { }
21712164
21722165impl < ' tcx > Debug for Place < ' tcx > {
21732166 fn fmt ( & self , fmt : & mut Formatter < ' _ > ) -> fmt:: Result {
@@ -2758,7 +2751,7 @@ impl<'tcx> UserTypeProjections {
27582751#[ derive( Clone , Debug , PartialEq , Eq , Hash , RustcEncodable , RustcDecodable , HashStable ) ]
27592752pub struct UserTypeProjection {
27602753 pub base : UserTypeAnnotationIndex ,
2761- pub projs : Vec < ProjectionElem < ( ) , ( ) > > ,
2754+ pub projs : Vec < ProjectionKind > ,
27622755}
27632756
27642757impl Copy for ProjectionKind { }
@@ -3587,12 +3580,7 @@ impl<'tcx> TypeFoldable<'tcx> for Operand<'tcx> {
35873580 }
35883581}
35893582
3590- impl < ' tcx , B , V , T > TypeFoldable < ' tcx > for Projection < B , V , T >
3591- where
3592- B : TypeFoldable < ' tcx > ,
3593- V : TypeFoldable < ' tcx > ,
3594- T : TypeFoldable < ' tcx > ,
3595- {
3583+ impl < ' tcx > TypeFoldable < ' tcx > for Projection < ' tcx > {
35963584 fn super_fold_with < ' gcx : ' tcx , F : TypeFolder < ' gcx , ' tcx > > ( & self , folder : & mut F ) -> Self {
35973585 use crate :: mir:: ProjectionElem :: * ;
35983586
0 commit comments