@@ -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 > > {
@@ -257,57 +255,6 @@ fn param_env_normalized_for_post_analysis(tcx: TyCtxt<'_>, def_id: DefId) -> ty:
257255 typing_env. with_post_analysis_normalized ( tcx) . param_env
258256}
259257
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-
311258/// Check if a function is async.
312259fn asyncness ( tcx : TyCtxt < ' _ > , def_id : LocalDefId ) -> ty:: Asyncness {
313260 let node = tcx. hir_node_by_def_id ( def_id) ;
@@ -367,7 +314,6 @@ pub(crate) fn provide(providers: &mut Providers) {
367314 adt_sized_constraint,
368315 param_env,
369316 param_env_normalized_for_post_analysis,
370- self_ty_of_trait_impl_enabling_order_dep_trait_object_hack,
371317 defaultness,
372318 unsizing_params_for_adt,
373319 ..* providers
0 commit comments