@@ -337,51 +337,49 @@ TrivialTypeTraversalAndLiftImpls! {
337
337
}
338
338
339
339
impl < ' tcx > CanonicalVarValues < ' tcx > {
340
- /// Creates dummy var values which should not be used in a
341
- /// canonical response.
342
- pub fn dummy ( ) -> CanonicalVarValues < ' tcx > {
343
- CanonicalVarValues { var_values : ty:: List :: empty ( ) }
344
- }
345
-
346
- #[ inline]
347
- pub fn len ( & self ) -> usize {
348
- self . var_values . len ( )
349
- }
350
-
351
- /// Makes an identity substitution from this one: each bound var
352
- /// is matched to the same bound var, preserving the original kinds.
353
- /// For example, if we have:
354
- /// `self.var_values == [Type(u32), Lifetime('a), Type(u64)]`
355
- /// we'll return a substitution `subst` with:
356
- /// `subst.var_values == [Type(^0), Lifetime(^1), Type(^2)]`.
357
- pub fn make_identity ( & self , tcx : TyCtxt < ' tcx > ) -> Self {
358
- use crate :: ty:: subst:: GenericArgKind ;
359
-
340
+ // Given a list of canonical variables, construct a set of values which are
341
+ // the identity response.
342
+ pub fn make_identity (
343
+ tcx : TyCtxt < ' tcx > ,
344
+ infos : CanonicalVarInfos < ' tcx > ,
345
+ ) -> CanonicalVarValues < ' tcx > {
360
346
CanonicalVarValues {
361
- var_values : tcx. mk_substs ( self . var_values . iter ( ) . enumerate ( ) . map (
362
- |( i, kind ) | -> ty:: GenericArg < ' tcx > {
363
- match kind . unpack ( ) {
364
- GenericArgKind :: Type ( .. ) => tcx
347
+ var_values : tcx. mk_substs ( infos . iter ( ) . enumerate ( ) . map (
348
+ |( i, info ) | -> ty:: GenericArg < ' tcx > {
349
+ match info . kind {
350
+ CanonicalVarKind :: Ty ( _ ) | CanonicalVarKind :: PlaceholderTy ( _ ) => tcx
365
351
. mk_ty ( ty:: Bound ( ty:: INNERMOST , ty:: BoundVar :: from_usize ( i) . into ( ) ) )
366
352
. into ( ) ,
367
- GenericArgKind :: Lifetime ( .. ) => {
353
+ CanonicalVarKind :: Region ( _ ) | CanonicalVarKind :: PlaceholderRegion ( _ ) => {
368
354
let br = ty:: BoundRegion {
369
355
var : ty:: BoundVar :: from_usize ( i) ,
370
356
kind : ty:: BrAnon ( i as u32 , None ) ,
371
357
} ;
372
358
tcx. mk_region ( ty:: ReLateBound ( ty:: INNERMOST , br) ) . into ( )
373
359
}
374
- GenericArgKind :: Const ( ct) => tcx
360
+ CanonicalVarKind :: Const ( _, ty)
361
+ | CanonicalVarKind :: PlaceholderConst ( _, ty) => tcx
375
362
. mk_const (
376
363
ty:: ConstKind :: Bound ( ty:: INNERMOST , ty:: BoundVar :: from_usize ( i) ) ,
377
- ct . ty ( ) ,
364
+ ty ,
378
365
)
379
366
. into ( ) ,
380
367
}
381
368
} ,
382
369
) ) ,
383
370
}
384
371
}
372
+
373
+ /// Creates dummy var values which should not be used in a
374
+ /// canonical response.
375
+ pub fn dummy ( ) -> CanonicalVarValues < ' tcx > {
376
+ CanonicalVarValues { var_values : ty:: List :: empty ( ) }
377
+ }
378
+
379
+ #[ inline]
380
+ pub fn len ( & self ) -> usize {
381
+ self . var_values . len ( )
382
+ }
385
383
}
386
384
387
385
impl < ' a , ' tcx > IntoIterator for & ' a CanonicalVarValues < ' tcx > {
0 commit comments