@@ -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
@@ -63,14 +63,14 @@ impl<'tcx> TyCtxt<'tcx> {
63
63
// with `collect()` because of the need to sometimes skip subtrees
64
64
// in the `subtys` iterator (e.g., when encountering a
65
65
// projection).
66
- match ty. kind {
67
- ty:: Closure ( def_id, ref substs) => {
66
+ match ty. into ( ) {
67
+ ty:: view :: Closure ( def_id, ref substs) => {
68
68
for upvar_ty in substs. as_closure ( ) . upvar_tys ( def_id, * self ) {
69
69
self . compute_components ( upvar_ty, out) ;
70
70
}
71
71
}
72
72
73
- ty:: Generator ( def_id, ref substs, _) => {
73
+ ty:: view :: Generator ( def_id, ref substs, _) => {
74
74
// Same as the closure case
75
75
for upvar_ty in substs. as_generator ( ) . upvar_tys ( def_id, * self ) {
76
76
self . compute_components ( upvar_ty, out) ;
@@ -81,12 +81,12 @@ impl<'tcx> TyCtxt<'tcx> {
81
81
}
82
82
83
83
// All regions are bound inside a witness
84
- ty:: GeneratorWitness ( ..) => ( ) ,
84
+ ty:: view :: GeneratorWitness ( ..) => ( ) ,
85
85
86
86
// OutlivesTypeParameterEnv -- the actual checking that `X:'a`
87
87
// 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 ) ) ;
90
90
}
91
91
92
92
// For projections, we prefer to generate an obligation like
@@ -97,15 +97,15 @@ impl<'tcx> TyCtxt<'tcx> {
97
97
// trait-ref. Therefore, if we see any higher-ranke regions,
98
98
// we simply fallback to the most restrictive rule, which
99
99
// requires that `Pi: 'a` for all `i`.
100
- ty:: Projection ( ref data) => {
100
+ ty:: view :: Projection ( data) => {
101
101
if !data. has_escaping_bound_vars ( ) {
102
102
// best case: no escaping regions, so push the
103
103
// projection and skip the subtree (thus generating no
104
104
// constraints for Pi). This defers the choice between
105
105
// the rules OutlivesProjectionEnv,
106
106
// OutlivesProjectionTraitDef, and
107
107
// OutlivesProjectionComponents to regionck.
108
- out. push ( Component :: Projection ( * data) ) ;
108
+ out. push ( Component :: Projection ( data) ) ;
109
109
} else {
110
110
// fallback case: hard code
111
111
// OutlivesProjectionComponents. Continue walking
@@ -115,12 +115,12 @@ impl<'tcx> TyCtxt<'tcx> {
115
115
}
116
116
}
117
117
118
- ty:: UnnormalizedProjection ( ..) => bug ! ( "only used with chalk-engine" ) ,
118
+ ty:: view :: UnnormalizedProjection ( ..) => bug ! ( "only used with chalk-engine" ) ,
119
119
120
120
// We assume that inference variables are fully resolved.
121
121
// So, if we encounter an inference variable, just record
122
122
// the unresolved variable as a component.
123
- ty:: Infer ( infer_ty) => {
123
+ ty:: view :: Infer ( infer_ty) => {
124
124
out. push ( Component :: UnresolvedInferenceVariable ( infer_ty) ) ;
125
125
}
126
126
@@ -130,27 +130,27 @@ impl<'tcx> TyCtxt<'tcx> {
130
130
// the type and then visits the types that are lexically
131
131
// contained within. (The comments refer to relevant rules
132
132
// 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 => {
154
154
// (*) Bare functions and traits are both binders. In the
155
155
// RFC, this means we would add the bound regions to the
156
156
// "bound regions list". In our representation, no such
0 commit comments