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