@@ -20,7 +20,7 @@ pub enum Component<'tcx> {
2020 // is not in a position to judge which is the best technique, so
2121 // we just product the projection as a component and leave it to
2222 // the consumer to decide (but see `EscapingProjection` below).
23- Projection ( ty:: ProjectionTy < ' tcx > ) ,
23+ Projection ( ty:: View < ' tcx , ty :: ProjectionTy < ' tcx > > ) ,
2424
2525 // In the case where a projection has escaping regions -- meaning
2626 // regions bound within the type itself -- we always use
@@ -63,14 +63,14 @@ impl<'tcx> TyCtxt<'tcx> {
6363 // with `collect()` because of the need to sometimes skip subtrees
6464 // in the `subtys` iterator (e.g., when encountering a
6565 // projection).
66- match ty. kind {
67- ty:: Closure ( def_id, ref substs) => {
66+ match ty. into ( ) {
67+ ty:: view :: Closure ( def_id, ref substs) => {
6868 for upvar_ty in substs. as_closure ( ) . upvar_tys ( def_id, * self ) {
6969 self . compute_components ( upvar_ty, out) ;
7070 }
7171 }
7272
73- ty:: Generator ( def_id, ref substs, _) => {
73+ ty:: view :: Generator ( def_id, ref substs, _) => {
7474 // Same as the closure case
7575 for upvar_ty in substs. as_generator ( ) . upvar_tys ( def_id, * self ) {
7676 self . compute_components ( upvar_ty, out) ;
@@ -81,12 +81,12 @@ impl<'tcx> TyCtxt<'tcx> {
8181 }
8282
8383 // All regions are bound inside a witness
84- ty:: GeneratorWitness ( ..) => ( ) ,
84+ ty:: view :: GeneratorWitness ( ..) => ( ) ,
8585
8686 // OutlivesTypeParameterEnv -- the actual checking that `X:'a`
8787 // is implied by the environment is done in regionck.
88- ty:: Param ( _ ) => {
89- out. push ( Component :: Param ( ty :: View :: new ( ty ) . unwrap ( ) ) ) ;
88+ ty:: view :: Param ( p ) => {
89+ out. push ( Component :: Param ( p ) ) ;
9090 }
9191
9292 // For projections, we prefer to generate an obligation like
@@ -97,15 +97,15 @@ impl<'tcx> TyCtxt<'tcx> {
9797 // trait-ref. Therefore, if we see any higher-ranke regions,
9898 // we simply fallback to the most restrictive rule, which
9999 // requires that `Pi: 'a` for all `i`.
100- ty:: Projection ( ref data) => {
100+ ty:: view :: Projection ( data) => {
101101 if !data. has_escaping_bound_vars ( ) {
102102 // best case: no escaping regions, so push the
103103 // projection and skip the subtree (thus generating no
104104 // constraints for Pi). This defers the choice between
105105 // the rules OutlivesProjectionEnv,
106106 // OutlivesProjectionTraitDef, and
107107 // OutlivesProjectionComponents to regionck.
108- out. push ( Component :: Projection ( * data) ) ;
108+ out. push ( Component :: Projection ( data) ) ;
109109 } else {
110110 // fallback case: hard code
111111 // OutlivesProjectionComponents. Continue walking
@@ -115,12 +115,12 @@ impl<'tcx> TyCtxt<'tcx> {
115115 }
116116 }
117117
118- ty:: UnnormalizedProjection ( ..) => bug ! ( "only used with chalk-engine" ) ,
118+ ty:: view :: UnnormalizedProjection ( ..) => bug ! ( "only used with chalk-engine" ) ,
119119
120120 // We assume that inference variables are fully resolved.
121121 // So, if we encounter an inference variable, just record
122122 // the unresolved variable as a component.
123- ty:: Infer ( infer_ty) => {
123+ ty:: view :: Infer ( infer_ty) => {
124124 out. push ( Component :: UnresolvedInferenceVariable ( infer_ty) ) ;
125125 }
126126
@@ -130,27 +130,27 @@ impl<'tcx> TyCtxt<'tcx> {
130130 // the type and then visits the types that are lexically
131131 // contained within. (The comments refer to relevant rules
132132 // from RFC1214.)
133- ty:: Bool | // OutlivesScalar
134- ty:: Char | // OutlivesScalar
135- ty:: Int ( ..) | // OutlivesScalar
136- ty:: Uint ( ..) | // OutlivesScalar
137- ty:: Float ( ..) | // OutlivesScalar
138- ty:: Never | // ...
139- ty:: Adt ( ..) | // OutlivesNominalType
140- ty:: Opaque ( ..) | // OutlivesNominalType (ish)
141- ty:: Foreign ( ..) | // OutlivesNominalType
142- ty:: Str | // OutlivesScalar (ish)
143- ty:: Array ( ..) | // ...
144- ty:: Slice ( ..) | // ...
145- ty:: RawPtr ( ..) | // ...
146- ty:: Ref ( ..) | // OutlivesReference
147- ty:: Tuple ( ..) | // ...
148- ty:: FnDef ( ..) | // OutlivesFunction (*)
149- ty:: FnPtr ( _) | // OutlivesFunction (*)
150- ty:: Dynamic ( ..) | // OutlivesObject, OutlivesFragment (*)
151- ty:: Placeholder ( ..) |
152- ty:: Bound ( ..) |
153- ty:: Error => {
133+ ty:: view :: Bool | // OutlivesScalar
134+ ty:: view :: Char | // OutlivesScalar
135+ ty:: view :: Int ( ..) | // OutlivesScalar
136+ ty:: view :: Uint ( ..) | // OutlivesScalar
137+ ty:: view :: Float ( ..) | // OutlivesScalar
138+ ty:: view :: Never | // ...
139+ ty:: view :: Adt ( ..) | // OutlivesNominalType
140+ ty:: view :: Opaque ( ..) | // OutlivesNominalType (ish)
141+ ty:: view :: Foreign ( ..) | // OutlivesNominalType
142+ ty:: view :: Str | // OutlivesScalar (ish)
143+ ty:: view :: Array ( ..) | // ...
144+ ty:: view :: Slice ( ..) | // ...
145+ ty:: view :: RawPtr ( ..) | // ...
146+ ty:: view :: Ref ( ..) | // OutlivesReference
147+ ty:: view :: Tuple ( ..) | // ...
148+ ty:: view :: FnDef ( ..) | // OutlivesFunction (*)
149+ ty:: view :: FnPtr ( _) | // OutlivesFunction (*)
150+ ty:: view :: Dynamic ( ..) | // OutlivesObject, OutlivesFragment (*)
151+ ty:: view :: Placeholder ( ..) |
152+ ty:: view :: Bound ( ..) |
153+ ty:: view :: Error => {
154154 // (*) Bare functions and traits are both binders. In the
155155 // RFC, this means we would add the bound regions to the
156156 // "bound regions list". In our representation, no such
0 commit comments