@@ -243,37 +243,39 @@ fn param_env_reveal_all_normalized(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamE
243243 tcx. param_env ( def_id) . with_reveal_all_normalized ( tcx)
244244}
245245
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`.
247248///
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:?}" ) ) ;
255257
256258 let trait_ref = impl_. trait_ref . skip_binder ( ) ;
257- debug ! ( "issue33140_self_ty({:?}), trait-ref={:?}" , def_id , trait_ref) ;
259+ debug ! ( ? trait_ref) ;
258260
259261 let is_marker_like = impl_. polarity == ty:: ImplPolarity :: Positive
260262 && tcx. associated_item_def_ids ( trait_ref. def_id ) . is_empty ( ) ;
261263
262264 // Check whether these impls would be ok for a marker trait.
263265 if !is_marker_like {
264- debug ! ( "issue33140_self_ty - not marker-like!" ) ;
266+ debug ! ( "not marker-like!" ) ;
265267 return None ;
266268 }
267269
268270 // impl must be `impl Trait for dyn Marker1 + Marker2 + ...`
269271 if trait_ref. args . len ( ) != 1 {
270- debug ! ( "issue33140_self_ty - impl has args!" ) ;
272+ debug ! ( "impl has args!" ) ;
271273 return None ;
272274 }
273275
274276 let predicates = tcx. predicates_of ( def_id) ;
275277 if predicates. parent . is_some ( ) || !predicates. predicates . is_empty ( ) {
276- debug ! ( "issue33140_self_ty - impl has predicates {:?}!" , predicates ) ;
278+ debug ! ( ?predicates , " impl has predicates!" ) ;
277279 return None ;
278280 }
279281
@@ -284,10 +286,10 @@ fn issue33140_self_ty(tcx: TyCtxt<'_>, def_id: DefId) -> Option<EarlyBinder<Ty<'
284286 } ;
285287
286288 if self_ty_matches {
287- debug ! ( "issue33140_self_ty - MATCHES!" ) ;
289+ debug ! ( "MATCHES!" ) ;
288290 Some ( EarlyBinder :: bind ( self_ty) )
289291 } else {
290- debug ! ( "issue33140_self_ty - non-matching self type" ) ;
292+ debug ! ( "non-matching self type" ) ;
291293 None
292294 }
293295}
@@ -351,7 +353,7 @@ pub(crate) fn provide(providers: &mut Providers) {
351353 adt_sized_constraint,
352354 param_env,
353355 param_env_reveal_all_normalized,
354- issue33140_self_ty ,
356+ self_ty_of_trait_impl_enabling_order_dep_trait_object_hack ,
355357 defaultness,
356358 unsizing_params_for_adt,
357359 ..* providers
0 commit comments