@@ -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
@@ -61,13 +61,13 @@ fn compute_components(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, out: &mut SmallVec<[Compo
6161 // in the `subtys` iterator (e.g., when encountering a
6262 // projection).
6363 match ty. kind {
64- ty:: Closure ( def_id, ref substs) => {
64+ ty:: view :: Closure ( def_id, ref substs) => {
6565 for upvar_ty in substs. as_closure ( ) . upvar_tys ( def_id, tcx) {
6666 compute_components ( tcx, upvar_ty, out) ;
6767 }
6868 }
6969
70- ty:: Generator ( def_id, ref substs, _) => {
70+ ty:: view :: Generator ( def_id, ref substs, _) => {
7171 // Same as the closure case
7272 for upvar_ty in substs. as_generator ( ) . upvar_tys ( def_id, tcx) {
7373 compute_components ( tcx, upvar_ty, out) ;
@@ -78,12 +78,12 @@ fn compute_components(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, out: &mut SmallVec<[Compo
7878 }
7979
8080 // All regions are bound inside a witness
81- ty:: GeneratorWitness ( ..) => ( ) ,
81+ ty:: view :: GeneratorWitness ( ..) => ( ) ,
8282
8383 // OutlivesTypeParameterEnv -- the actual checking that `X:'a`
8484 // is implied by the environment is done in regionck.
85- ty:: Param ( _ ) => {
86- out. push ( Component :: Param ( ty :: View :: new ( ty ) . unwrap ( ) ) ) ;
85+ ty:: view :: Param ( p ) => {
86+ out. push ( Component :: Param ( p ) ) ;
8787 }
8888
8989 // For projections, we prefer to generate an obligation like
@@ -94,15 +94,15 @@ fn compute_components(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, out: &mut SmallVec<[Compo
9494 // trait-ref. Therefore, if we see any higher-ranke regions,
9595 // we simply fallback to the most restrictive rule, which
9696 // requires that `Pi: 'a` for all `i`.
97- ty:: Projection ( ref data) => {
97+ ty:: view :: Projection ( data) => {
9898 if !data. has_escaping_bound_vars ( ) {
9999 // best case: no escaping regions, so push the
100100 // projection and skip the subtree (thus generating no
101101 // constraints for Pi). This defers the choice between
102102 // the rules OutlivesProjectionEnv,
103103 // OutlivesProjectionTraitDef, and
104104 // OutlivesProjectionComponents to regionck.
105- out. push ( Component :: Projection ( * data) ) ;
105+ out. push ( Component :: Projection ( data) ) ;
106106 } else {
107107 // fallback case: hard code
108108 // OutlivesProjectionComponents. Continue walking
@@ -112,12 +112,12 @@ fn compute_components(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, out: &mut SmallVec<[Compo
112112 }
113113 }
114114
115- ty:: UnnormalizedProjection ( ..) => bug ! ( "only used with chalk-engine" ) ,
115+ ty:: view :: UnnormalizedProjection ( ..) => bug ! ( "only used with chalk-engine" ) ,
116116
117117 // We assume that inference variables are fully resolved.
118118 // So, if we encounter an inference variable, just record
119119 // the unresolved variable as a component.
120- ty:: Infer ( infer_ty) => {
120+ ty:: view :: Infer ( infer_ty) => {
121121 out. push ( Component :: UnresolvedInferenceVariable ( infer_ty) ) ;
122122 }
123123
@@ -127,27 +127,27 @@ fn compute_components(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, out: &mut SmallVec<[Compo
127127 // the type and then visits the types that are lexically
128128 // contained within. (The comments refer to relevant rules
129129 // from RFC1214.)
130- ty:: Bool | // OutlivesScalar
131- ty:: Char | // OutlivesScalar
132- ty:: Int ( ..) | // OutlivesScalar
133- ty:: Uint ( ..) | // OutlivesScalar
134- ty:: Float ( ..) | // OutlivesScalar
135- ty:: Never | // ...
136- ty:: Adt ( ..) | // OutlivesNominalType
137- ty:: Opaque ( ..) | // OutlivesNominalType (ish)
138- ty:: Foreign ( ..) | // OutlivesNominalType
139- ty:: Str | // OutlivesScalar (ish)
140- ty:: Array ( ..) | // ...
141- ty:: Slice ( ..) | // ...
142- ty:: RawPtr ( ..) | // ...
143- ty:: Ref ( ..) | // OutlivesReference
144- ty:: Tuple ( ..) | // ...
145- ty:: FnDef ( ..) | // OutlivesFunction (*)
146- ty:: FnPtr ( _) | // OutlivesFunction (*)
147- ty:: Dynamic ( ..) | // OutlivesObject, OutlivesFragment (*)
148- ty:: Placeholder ( ..) |
149- ty:: Bound ( ..) |
150- ty:: Error => {
130+ ty:: view :: Bool | // OutlivesScalar
131+ ty:: view :: Char | // OutlivesScalar
132+ ty:: view :: Int ( ..) | // OutlivesScalar
133+ ty:: view :: Uint ( ..) | // OutlivesScalar
134+ ty:: view :: Float ( ..) | // OutlivesScalar
135+ ty:: view :: Never | // ...
136+ ty:: view :: Adt ( ..) | // OutlivesNominalType
137+ ty:: view :: Opaque ( ..) | // OutlivesNominalType (ish)
138+ ty:: view :: Foreign ( ..) | // OutlivesNominalType
139+ ty:: view :: Str | // OutlivesScalar (ish)
140+ ty:: view :: Array ( ..) | // ...
141+ ty:: view :: Slice ( ..) | // ...
142+ ty:: view :: RawPtr ( ..) | // ...
143+ ty:: view :: Ref ( ..) | // OutlivesReference
144+ ty:: view :: Tuple ( ..) | // ...
145+ ty:: view :: FnDef ( ..) | // OutlivesFunction (*)
146+ ty:: view :: FnPtr ( _) | // OutlivesFunction (*)
147+ ty:: view :: Dynamic ( ..) | // OutlivesObject, OutlivesFragment (*)
148+ ty:: view :: Placeholder ( ..) |
149+ ty:: view :: Bound ( ..) |
150+ ty:: view :: Error => {
151151 // (*) Bare functions and traits are both binders. In the
152152 // RFC, this means we would add the bound regions to the
153153 // "bound regions list". In our representation, no such
0 commit comments