4242 ClosureSimplifiedType ( D ) ,
4343 GeneratorSimplifiedType ( D ) ,
4444 GeneratorWitnessSimplifiedType ( usize ) ,
45- OpaqueSimplifiedType ( D ) ,
4645 FunctionSimplifiedType ( usize ) ,
4746 PlaceholderSimplifiedType ,
4847}
@@ -127,7 +126,7 @@ pub fn simplify_type<'tcx>(
127126 TreatParams :: AsPlaceholder => Some ( PlaceholderSimplifiedType ) ,
128127 TreatParams :: AsInfer => None ,
129128 } ,
130- ty:: Projection ( _) => match treat_params {
129+ ty:: Opaque ( .. ) | ty :: Projection ( _) => match treat_params {
131130 // When treating `ty::Param` as a placeholder, projections also
132131 // don't unify with anything else as long as they are fully normalized.
133132 //
@@ -138,7 +137,6 @@ pub fn simplify_type<'tcx>(
138137 }
139138 TreatParams :: AsPlaceholder | TreatParams :: AsInfer => None ,
140139 } ,
141- ty:: Opaque ( def_id, _) => Some ( OpaqueSimplifiedType ( def_id) ) ,
142140 ty:: Foreign ( def_id) => Some ( ForeignSimplifiedType ( def_id) ) ,
143141 ty:: Bound ( ..) | ty:: Infer ( _) | ty:: Error ( _) => None ,
144142 }
@@ -151,8 +149,7 @@ impl<D: Copy + Debug + Eq> SimplifiedTypeGen<D> {
151149 | ForeignSimplifiedType ( d)
152150 | TraitSimplifiedType ( d)
153151 | ClosureSimplifiedType ( d)
154- | GeneratorSimplifiedType ( d)
155- | OpaqueSimplifiedType ( d) => Some ( d) ,
152+ | GeneratorSimplifiedType ( d) => Some ( d) ,
156153 _ => None ,
157154 }
158155 }
@@ -182,7 +179,6 @@ impl<D: Copy + Debug + Eq> SimplifiedTypeGen<D> {
182179 ClosureSimplifiedType ( d) => ClosureSimplifiedType ( map ( d) ) ,
183180 GeneratorSimplifiedType ( d) => GeneratorSimplifiedType ( map ( d) ) ,
184181 GeneratorWitnessSimplifiedType ( n) => GeneratorWitnessSimplifiedType ( n) ,
185- OpaqueSimplifiedType ( d) => OpaqueSimplifiedType ( map ( d) ) ,
186182 FunctionSimplifiedType ( n) => FunctionSimplifiedType ( n) ,
187183 PlaceholderSimplifiedType => PlaceholderSimplifiedType ,
188184 }
@@ -229,7 +225,7 @@ impl DeepRejectCtxt {
229225 match impl_ty. kind ( ) {
230226 // Start by checking whether the type in the impl may unify with
231227 // pretty much everything. Just return `true` in that case.
232- ty:: Param ( _) | ty:: Projection ( _) | ty:: Error ( _) => return true ,
228+ ty:: Param ( _) | ty:: Projection ( _) | ty:: Error ( _) | ty :: Opaque ( .. ) => return true ,
233229 // These types only unify with inference variables or their own
234230 // variant.
235231 ty:: Bool
@@ -247,8 +243,7 @@ impl DeepRejectCtxt {
247243 | ty:: Never
248244 | ty:: Tuple ( ..)
249245 | ty:: FnPtr ( ..)
250- | ty:: Foreign ( ..)
251- | ty:: Opaque ( ..) => { }
246+ | ty:: Foreign ( ..) => { }
252247 ty:: FnDef ( ..)
253248 | ty:: Closure ( ..)
254249 | ty:: Generator ( ..)
@@ -328,10 +323,7 @@ impl DeepRejectCtxt {
328323 _ => false ,
329324 } ,
330325
331- // Opaque types in impls should be forbidden, but that doesn't
332- // stop compilation. So this match arm should never return true
333- // if compilation succeeds.
334- ty:: Opaque ( ..) => matches ! ( k, ty:: Opaque ( ..) ) ,
326+ ty:: Opaque ( ..) => true ,
335327
336328 // Impls cannot contain these types as these cannot be named directly.
337329 ty:: FnDef ( ..) | ty:: Closure ( ..) | ty:: Generator ( ..) => false ,
0 commit comments