@@ -15,16 +15,7 @@ pub fn anonymize_predicate<'tcx>(
1515 let new = ty:: PredicateKind :: ForAll ( tcx. anonymize_late_bound_regions ( binder) ) ;
1616 tcx. reuse_or_mk_predicate ( pred, new)
1717 }
18- ty:: PredicateKind :: Trait ( _, _)
19- | ty:: PredicateKind :: RegionOutlives ( _)
20- | ty:: PredicateKind :: TypeOutlives ( _)
21- | ty:: PredicateKind :: Projection ( _)
22- | ty:: PredicateKind :: WellFormed ( _)
23- | ty:: PredicateKind :: ObjectSafe ( _)
24- | ty:: PredicateKind :: ClosureKind ( _, _, _)
25- | ty:: PredicateKind :: Subtype ( _)
26- | ty:: PredicateKind :: ConstEvaluatable ( _, _)
27- | ty:: PredicateKind :: ConstEquate ( _, _) => pred,
18+ ty:: PredicateKind :: Atom ( _) => pred,
2819 }
2920}
3021
@@ -137,11 +128,8 @@ impl Elaborator<'tcx> {
137128 fn elaborate ( & mut self , obligation : & PredicateObligation < ' tcx > ) {
138129 let tcx = self . visited . tcx ;
139130
140- match obligation. predicate . ignore_quantifiers ( ) . skip_binder ( ) . kind ( ) {
141- ty:: PredicateKind :: ForAll ( _) => {
142- bug ! ( "unexpected predicate: {:?}" , obligation. predicate)
143- }
144- ty:: PredicateKind :: Trait ( data, _) => {
131+ match obligation. predicate . skip_binders ( ) {
132+ ty:: PredicateAtom :: Trait ( data, _) => {
145133 // Get predicates declared on the trait.
146134 let predicates = tcx. super_predicates_of ( data. def_id ( ) ) ;
147135
@@ -162,36 +150,36 @@ impl Elaborator<'tcx> {
162150
163151 self . stack . extend ( obligations) ;
164152 }
165- ty:: PredicateKind :: WellFormed ( ..) => {
153+ ty:: PredicateAtom :: WellFormed ( ..) => {
166154 // Currently, we do not elaborate WF predicates,
167155 // although we easily could.
168156 }
169- ty:: PredicateKind :: ObjectSafe ( ..) => {
157+ ty:: PredicateAtom :: ObjectSafe ( ..) => {
170158 // Currently, we do not elaborate object-safe
171159 // predicates.
172160 }
173- ty:: PredicateKind :: Subtype ( ..) => {
161+ ty:: PredicateAtom :: Subtype ( ..) => {
174162 // Currently, we do not "elaborate" predicates like `X <: Y`,
175163 // though conceivably we might.
176164 }
177- ty:: PredicateKind :: Projection ( ..) => {
165+ ty:: PredicateAtom :: Projection ( ..) => {
178166 // Nothing to elaborate in a projection predicate.
179167 }
180- ty:: PredicateKind :: ClosureKind ( ..) => {
168+ ty:: PredicateAtom :: ClosureKind ( ..) => {
181169 // Nothing to elaborate when waiting for a closure's kind to be inferred.
182170 }
183- ty:: PredicateKind :: ConstEvaluatable ( ..) => {
171+ ty:: PredicateAtom :: ConstEvaluatable ( ..) => {
184172 // Currently, we do not elaborate const-evaluatable
185173 // predicates.
186174 }
187- ty:: PredicateKind :: ConstEquate ( ..) => {
175+ ty:: PredicateAtom :: ConstEquate ( ..) => {
188176 // Currently, we do not elaborate const-equate
189177 // predicates.
190178 }
191- ty:: PredicateKind :: RegionOutlives ( ..) => {
179+ ty:: PredicateAtom :: RegionOutlives ( ..) => {
192180 // Nothing to elaborate from `'a: 'b`.
193181 }
194- ty:: PredicateKind :: TypeOutlives ( ty:: OutlivesPredicate ( ty_max, r_min) ) => {
182+ ty:: PredicateAtom :: TypeOutlives ( ty:: OutlivesPredicate ( ty_max, r_min) ) => {
195183 // We know that `T: 'a` for some type `T`. We can
196184 // often elaborate this. For example, if we know that
197185 // `[U]: 'a`, that implies that `U: 'a`. Similarly, if
@@ -221,15 +209,15 @@ impl Elaborator<'tcx> {
221209 if r. is_late_bound ( ) {
222210 None
223211 } else {
224- Some ( ty:: PredicateKind :: RegionOutlives ( ty:: OutlivesPredicate (
212+ Some ( ty:: PredicateAtom :: RegionOutlives ( ty:: OutlivesPredicate (
225213 r, r_min,
226214 ) ) )
227215 }
228216 }
229217
230218 Component :: Param ( p) => {
231219 let ty = tcx. mk_ty_param ( p. index , p. name ) ;
232- Some ( ty:: PredicateKind :: TypeOutlives ( ty:: OutlivesPredicate (
220+ Some ( ty:: PredicateAtom :: TypeOutlives ( ty:: OutlivesPredicate (
233221 ty, r_min,
234222 ) ) )
235223 }
0 commit comments