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