@@ -20,7 +20,7 @@ pub enum Component<'tcx> {
20
20
// is not in a position to judge which is the best technique, so
21
21
// we just product the projection as a component and leave it to
22
22
// the consumer to decide (but see `EscapingProjection` below).
23
- Projection ( ty:: ProjectionTy < ' tcx > ) ,
23
+ Projection ( ty:: View < ' tcx , ty :: ProjectionTy < ' tcx > > ) ,
24
24
25
25
// In the case where a projection has escaping regions -- meaning
26
26
// 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
61
61
// in the `subtys` iterator (e.g., when encountering a
62
62
// projection).
63
63
match ty. kind {
64
- ty:: Closure ( def_id, ref substs) => {
64
+ ty:: view :: Closure ( def_id, ref substs) => {
65
65
for upvar_ty in substs. as_closure ( ) . upvar_tys ( def_id, tcx) {
66
66
compute_components ( tcx, upvar_ty, out) ;
67
67
}
68
68
}
69
69
70
- ty:: Generator ( def_id, ref substs, _) => {
70
+ ty:: view :: Generator ( def_id, ref substs, _) => {
71
71
// Same as the closure case
72
72
for upvar_ty in substs. as_generator ( ) . upvar_tys ( def_id, tcx) {
73
73
compute_components ( tcx, upvar_ty, out) ;
@@ -78,12 +78,12 @@ fn compute_components(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, out: &mut SmallVec<[Compo
78
78
}
79
79
80
80
// All regions are bound inside a witness
81
- ty:: GeneratorWitness ( ..) => ( ) ,
81
+ ty:: view :: GeneratorWitness ( ..) => ( ) ,
82
82
83
83
// OutlivesTypeParameterEnv -- the actual checking that `X:'a`
84
84
// 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 ) ) ;
87
87
}
88
88
89
89
// 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
94
94
// trait-ref. Therefore, if we see any higher-ranke regions,
95
95
// we simply fallback to the most restrictive rule, which
96
96
// requires that `Pi: 'a` for all `i`.
97
- ty:: Projection ( ref data) => {
97
+ ty:: view :: Projection ( data) => {
98
98
if !data. has_escaping_bound_vars ( ) {
99
99
// best case: no escaping regions, so push the
100
100
// projection and skip the subtree (thus generating no
101
101
// constraints for Pi). This defers the choice between
102
102
// the rules OutlivesProjectionEnv,
103
103
// OutlivesProjectionTraitDef, and
104
104
// OutlivesProjectionComponents to regionck.
105
- out. push ( Component :: Projection ( * data) ) ;
105
+ out. push ( Component :: Projection ( data) ) ;
106
106
} else {
107
107
// fallback case: hard code
108
108
// OutlivesProjectionComponents. Continue walking
@@ -112,12 +112,12 @@ fn compute_components(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, out: &mut SmallVec<[Compo
112
112
}
113
113
}
114
114
115
- ty:: UnnormalizedProjection ( ..) => bug ! ( "only used with chalk-engine" ) ,
115
+ ty:: view :: UnnormalizedProjection ( ..) => bug ! ( "only used with chalk-engine" ) ,
116
116
117
117
// We assume that inference variables are fully resolved.
118
118
// So, if we encounter an inference variable, just record
119
119
// the unresolved variable as a component.
120
- ty:: Infer ( infer_ty) => {
120
+ ty:: view :: Infer ( infer_ty) => {
121
121
out. push ( Component :: UnresolvedInferenceVariable ( infer_ty) ) ;
122
122
}
123
123
@@ -127,27 +127,27 @@ fn compute_components(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, out: &mut SmallVec<[Compo
127
127
// the type and then visits the types that are lexically
128
128
// contained within. (The comments refer to relevant rules
129
129
// 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 => {
151
151
// (*) Bare functions and traits are both binders. In the
152
152
// RFC, this means we would add the bound regions to the
153
153
// "bound regions list". In our representation, no such
0 commit comments