@@ -243,37 +243,39 @@ fn param_env_reveal_all_normalized(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamE
243
243
tcx. param_env ( def_id) . with_reveal_all_normalized ( tcx)
244
244
}
245
245
246
- /// If `def_id` is an issue 33140 hack impl, returns its self type; otherwise, returns `None`.
246
+ /// If the given trait impl enables exploiting the former order dependence of trait objects,
247
+ /// returns its self type; otherwise, returns `None`.
247
248
///
248
- /// See [`ty::ImplOverlapKind::Issue33140`] for more details.
249
- fn issue33140_self_ty ( tcx : TyCtxt < ' _ > , def_id : DefId ) -> Option < EarlyBinder < Ty < ' _ > > > {
250
- debug ! ( "issue33140_self_ty({:?})" , def_id) ;
251
-
252
- let impl_ = tcx
253
- . impl_trait_header ( def_id)
254
- . unwrap_or_else ( || bug ! ( "issue33140_self_ty called on inherent impl {:?}" , def_id) ) ;
249
+ /// See [`ty::ImplOverlapKind::FutureCompatOrderDepTraitObjects`] for more details.
250
+ #[ instrument( level = "debug" , skip( tcx) ) ]
251
+ fn self_ty_of_trait_impl_enabling_order_dep_trait_object_hack (
252
+ tcx : TyCtxt < ' _ > ,
253
+ def_id : DefId ,
254
+ ) -> Option < EarlyBinder < Ty < ' _ > > > {
255
+ let impl_ =
256
+ tcx. impl_trait_header ( def_id) . unwrap_or_else ( || bug ! ( "called on inherent impl {def_id:?}" ) ) ;
255
257
256
258
let trait_ref = impl_. trait_ref . skip_binder ( ) ;
257
- debug ! ( "issue33140_self_ty({:?}), trait-ref={:?}" , def_id , trait_ref) ;
259
+ debug ! ( ? trait_ref) ;
258
260
259
261
let is_marker_like = impl_. polarity == ty:: ImplPolarity :: Positive
260
262
&& tcx. associated_item_def_ids ( trait_ref. def_id ) . is_empty ( ) ;
261
263
262
264
// Check whether these impls would be ok for a marker trait.
263
265
if !is_marker_like {
264
- debug ! ( "issue33140_self_ty - not marker-like!" ) ;
266
+ debug ! ( "not marker-like!" ) ;
265
267
return None ;
266
268
}
267
269
268
270
// impl must be `impl Trait for dyn Marker1 + Marker2 + ...`
269
271
if trait_ref. args . len ( ) != 1 {
270
- debug ! ( "issue33140_self_ty - impl has args!" ) ;
272
+ debug ! ( "impl has args!" ) ;
271
273
return None ;
272
274
}
273
275
274
276
let predicates = tcx. predicates_of ( def_id) ;
275
277
if predicates. parent . is_some ( ) || !predicates. predicates . is_empty ( ) {
276
- debug ! ( "issue33140_self_ty - impl has predicates {:?}!" , predicates ) ;
278
+ debug ! ( ?predicates , " impl has predicates!" ) ;
277
279
return None ;
278
280
}
279
281
@@ -284,10 +286,10 @@ fn issue33140_self_ty(tcx: TyCtxt<'_>, def_id: DefId) -> Option<EarlyBinder<Ty<'
284
286
} ;
285
287
286
288
if self_ty_matches {
287
- debug ! ( "issue33140_self_ty - MATCHES!" ) ;
289
+ debug ! ( "MATCHES!" ) ;
288
290
Some ( EarlyBinder :: bind ( self_ty) )
289
291
} else {
290
- debug ! ( "issue33140_self_ty - non-matching self type" ) ;
292
+ debug ! ( "non-matching self type" ) ;
291
293
None
292
294
}
293
295
}
@@ -351,7 +353,7 @@ pub(crate) fn provide(providers: &mut Providers) {
351
353
adt_sized_constraint,
352
354
param_env,
353
355
param_env_reveal_all_normalized,
354
- issue33140_self_ty ,
356
+ self_ty_of_trait_impl_enabling_order_dep_trait_object_hack ,
355
357
defaultness,
356
358
unsizing_params_for_adt,
357
359
..* providers
0 commit comments