@@ -5,7 +5,7 @@ use std::fmt;
55use smallvec:: { smallvec, SmallVec } ;
66
77use crate :: constructor:: { Constructor , Slice , SliceKind } ;
8- use crate :: { PrivateUninhabitedField , TypeCx } ;
8+ use crate :: { PatCx , PrivateUninhabitedField } ;
99
1010use self :: Constructor :: * ;
1111
@@ -21,15 +21,15 @@ impl PatId {
2121}
2222
2323/// A pattern with an index denoting which field it corresponds to.
24- pub struct IndexedPat < Cx : TypeCx > {
24+ pub struct IndexedPat < Cx : PatCx > {
2525 pub idx : usize ,
2626 pub pat : DeconstructedPat < Cx > ,
2727}
2828
2929/// Values and patterns can be represented as a constructor applied to some fields. This represents
3030/// a pattern in this form. A `DeconstructedPat` will almost always come from user input; the only
3131/// exception are some `Wildcard`s introduced during pattern lowering.
32- pub struct DeconstructedPat < Cx : TypeCx > {
32+ pub struct DeconstructedPat < Cx : PatCx > {
3333 ctor : Constructor < Cx > ,
3434 fields : Vec < IndexedPat < Cx > > ,
3535 /// The number of fields in this pattern. E.g. if the pattern is `SomeStruct { field12: true, ..
@@ -43,7 +43,7 @@ pub struct DeconstructedPat<Cx: TypeCx> {
4343 pub ( crate ) uid : PatId ,
4444}
4545
46- impl < Cx : TypeCx > DeconstructedPat < Cx > {
46+ impl < Cx : PatCx > DeconstructedPat < Cx > {
4747 pub fn new (
4848 ctor : Constructor < Cx > ,
4949 fields : Vec < IndexedPat < Cx > > ,
@@ -136,7 +136,7 @@ impl<Cx: TypeCx> DeconstructedPat<Cx> {
136136}
137137
138138/// This is best effort and not good enough for a `Display` impl.
139- impl < Cx : TypeCx > fmt:: Debug for DeconstructedPat < Cx > {
139+ impl < Cx : PatCx > fmt:: Debug for DeconstructedPat < Cx > {
140140 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
141141 let pat = self ;
142142 let mut first = true ;
@@ -219,14 +219,14 @@ impl<Cx: TypeCx> fmt::Debug for DeconstructedPat<Cx> {
219219/// algorithm. Do not use `Wild` to represent a wildcard pattern comping from user input.
220220///
221221/// This is morally `Option<&'p DeconstructedPat>` where `None` is interpreted as a wildcard.
222- pub ( crate ) enum PatOrWild < ' p , Cx : TypeCx > {
222+ pub ( crate ) enum PatOrWild < ' p , Cx : PatCx > {
223223 /// A non-user-provided wildcard, created during specialization.
224224 Wild ,
225225 /// A user-provided pattern.
226226 Pat ( & ' p DeconstructedPat < Cx > ) ,
227227}
228228
229- impl < ' p , Cx : TypeCx > Clone for PatOrWild < ' p , Cx > {
229+ impl < ' p , Cx : PatCx > Clone for PatOrWild < ' p , Cx > {
230230 fn clone ( & self ) -> Self {
231231 match self {
232232 PatOrWild :: Wild => PatOrWild :: Wild ,
@@ -235,9 +235,9 @@ impl<'p, Cx: TypeCx> Clone for PatOrWild<'p, Cx> {
235235 }
236236}
237237
238- impl < ' p , Cx : TypeCx > Copy for PatOrWild < ' p , Cx > { }
238+ impl < ' p , Cx : PatCx > Copy for PatOrWild < ' p , Cx > { }
239239
240- impl < ' p , Cx : TypeCx > PatOrWild < ' p , Cx > {
240+ impl < ' p , Cx : PatCx > PatOrWild < ' p , Cx > {
241241 pub ( crate ) fn as_pat ( & self ) -> Option < & ' p DeconstructedPat < Cx > > {
242242 match self {
243243 PatOrWild :: Wild => None ,
@@ -283,7 +283,7 @@ impl<'p, Cx: TypeCx> PatOrWild<'p, Cx> {
283283 }
284284}
285285
286- impl < ' p , Cx : TypeCx > fmt:: Debug for PatOrWild < ' p , Cx > {
286+ impl < ' p , Cx : PatCx > fmt:: Debug for PatOrWild < ' p , Cx > {
287287 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
288288 match self {
289289 PatOrWild :: Wild => write ! ( f, "_" ) ,
@@ -295,19 +295,19 @@ impl<'p, Cx: TypeCx> fmt::Debug for PatOrWild<'p, Cx> {
295295/// Same idea as `DeconstructedPat`, except this is a fictitious pattern built up for diagnostics
296296/// purposes. As such they don't use interning and can be cloned.
297297#[ derive( Debug ) ]
298- pub struct WitnessPat < Cx : TypeCx > {
298+ pub struct WitnessPat < Cx : PatCx > {
299299 ctor : Constructor < Cx > ,
300300 pub ( crate ) fields : Vec < WitnessPat < Cx > > ,
301301 ty : Cx :: Ty ,
302302}
303303
304- impl < Cx : TypeCx > Clone for WitnessPat < Cx > {
304+ impl < Cx : PatCx > Clone for WitnessPat < Cx > {
305305 fn clone ( & self ) -> Self {
306306 Self { ctor : self . ctor . clone ( ) , fields : self . fields . clone ( ) , ty : self . ty . clone ( ) }
307307 }
308308}
309309
310- impl < Cx : TypeCx > WitnessPat < Cx > {
310+ impl < Cx : PatCx > WitnessPat < Cx > {
311311 pub ( crate ) fn new ( ctor : Constructor < Cx > , fields : Vec < Self > , ty : Cx :: Ty ) -> Self {
312312 Self { ctor, fields, ty }
313313 }
0 commit comments