@@ -6,13 +6,11 @@ use rustc_index::bit_set::DenseBitSet;
6
6
use rustc_middle:: bug;
7
7
use rustc_middle:: query:: Providers ;
8
8
use rustc_middle:: ty:: fold:: fold_regions;
9
- use rustc_middle:: ty:: {
10
- self , EarlyBinder , Ty , TyCtxt , TypeSuperVisitable , TypeVisitable , TypeVisitor , Upcast ,
11
- } ;
9
+ use rustc_middle:: ty:: { self , Ty , TyCtxt , TypeSuperVisitable , TypeVisitable , TypeVisitor , Upcast } ;
12
10
use rustc_span:: DUMMY_SP ;
13
11
use rustc_span:: def_id:: { CRATE_DEF_ID , DefId , LocalDefId } ;
14
12
use rustc_trait_selection:: traits;
15
- use tracing:: { debug , instrument} ;
13
+ use tracing:: instrument;
16
14
17
15
#[ instrument( level = "debug" , skip( tcx) , ret) ]
18
16
fn sized_constraint_for_ty < ' tcx > ( tcx : TyCtxt < ' tcx > , ty : Ty < ' tcx > ) -> Option < Ty < ' tcx > > {
@@ -257,57 +255,6 @@ fn param_env_normalized_for_post_analysis(tcx: TyCtxt<'_>, def_id: DefId) -> ty:
257
255
typing_env. with_post_analysis_normalized ( tcx) . param_env
258
256
}
259
257
260
- /// If the given trait impl enables exploiting the former order dependence of trait objects,
261
- /// returns its self type; otherwise, returns `None`.
262
- ///
263
- /// See [`ty::ImplOverlapKind::FutureCompatOrderDepTraitObjects`] for more details.
264
- #[ instrument( level = "debug" , skip( tcx) ) ]
265
- fn self_ty_of_trait_impl_enabling_order_dep_trait_object_hack (
266
- tcx : TyCtxt < ' _ > ,
267
- def_id : DefId ,
268
- ) -> Option < EarlyBinder < ' _ , Ty < ' _ > > > {
269
- let impl_ =
270
- tcx. impl_trait_header ( def_id) . unwrap_or_else ( || bug ! ( "called on inherent impl {def_id:?}" ) ) ;
271
-
272
- let trait_ref = impl_. trait_ref . skip_binder ( ) ;
273
- debug ! ( ?trait_ref) ;
274
-
275
- let is_marker_like = impl_. polarity == ty:: ImplPolarity :: Positive
276
- && tcx. associated_item_def_ids ( trait_ref. def_id ) . is_empty ( ) ;
277
-
278
- // Check whether these impls would be ok for a marker trait.
279
- if !is_marker_like {
280
- debug ! ( "not marker-like!" ) ;
281
- return None ;
282
- }
283
-
284
- // impl must be `impl Trait for dyn Marker1 + Marker2 + ...`
285
- if trait_ref. args . len ( ) != 1 {
286
- debug ! ( "impl has args!" ) ;
287
- return None ;
288
- }
289
-
290
- let predicates = tcx. predicates_of ( def_id) ;
291
- if predicates. parent . is_some ( ) || !predicates. predicates . is_empty ( ) {
292
- debug ! ( ?predicates, "impl has predicates!" ) ;
293
- return None ;
294
- }
295
-
296
- let self_ty = trait_ref. self_ty ( ) ;
297
- let self_ty_matches = match self_ty. kind ( ) {
298
- ty:: Dynamic ( data, re, _) if re. is_static ( ) => data. principal ( ) . is_none ( ) ,
299
- _ => false ,
300
- } ;
301
-
302
- if self_ty_matches {
303
- debug ! ( "MATCHES!" ) ;
304
- Some ( EarlyBinder :: bind ( self_ty) )
305
- } else {
306
- debug ! ( "non-matching self type" ) ;
307
- None
308
- }
309
- }
310
-
311
258
/// Check if a function is async.
312
259
fn asyncness ( tcx : TyCtxt < ' _ > , def_id : LocalDefId ) -> ty:: Asyncness {
313
260
let node = tcx. hir_node_by_def_id ( def_id) ;
@@ -367,7 +314,6 @@ pub(crate) fn provide(providers: &mut Providers) {
367
314
adt_sized_constraint,
368
315
param_env,
369
316
param_env_normalized_for_post_analysis,
370
- self_ty_of_trait_impl_enabling_order_dep_trait_object_hack,
371
317
defaultness,
372
318
unsizing_params_for_adt,
373
319
..* providers
0 commit comments