@@ -6,13 +6,11 @@ use rustc_index::bit_set::DenseBitSet;
66use rustc_middle:: bug;
77use rustc_middle:: query:: Providers ;
88use 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 } ;
1210use rustc_span:: DUMMY_SP ;
1311use rustc_span:: def_id:: { CRATE_DEF_ID , DefId , LocalDefId } ;
1412use rustc_trait_selection:: traits;
15- use tracing:: { debug , instrument} ;
13+ use tracing:: instrument;
1614
1715#[ instrument( level = "debug" , skip( tcx) , ret) ]
1816fn 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:
260258 typing_env. with_post_analysis_normalized ( tcx) . param_env
261259}
262260
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-
314261/// Check if a function is async.
315262fn asyncness ( tcx : TyCtxt < ' _ > , def_id : LocalDefId ) -> ty:: Asyncness {
316263 let node = tcx. hir_node_by_def_id ( def_id) ;
@@ -370,7 +317,6 @@ pub(crate) fn provide(providers: &mut Providers) {
370317 adt_sized_constraint,
371318 param_env,
372319 param_env_normalized_for_post_analysis,
373- self_ty_of_trait_impl_enabling_order_dep_trait_object_hack,
374320 defaultness,
375321 unsizing_params_for_adt,
376322 ..* providers
0 commit comments