@@ -12,9 +12,7 @@ use hir::LangItem;
1212use hir:: def_id:: DefId ;
1313use rustc_data_structures:: fx:: { FxHashSet , FxIndexSet } ;
1414use rustc_hir as hir;
15- use rustc_infer:: traits:: {
16- Obligation , ObligationCause , PolyTraitObligation , PredicateObligations , SelectionError ,
17- } ;
15+ use rustc_infer:: traits:: { Obligation , PolyTraitObligation , SelectionError } ;
1816use rustc_middle:: ty:: fast_reject:: DeepRejectCtxt ;
1917use rustc_middle:: ty:: { self , Ty , TypeVisitableExt , TypingMode } ;
2018use rustc_middle:: { bug, span_bug} ;
@@ -23,8 +21,6 @@ use tracing::{debug, instrument, trace};
2321
2422use super :: SelectionCandidate :: * ;
2523use super :: { BuiltinImplConditions , SelectionCandidateSet , SelectionContext , TraitObligationStack } ;
26- use crate :: traits;
27- use crate :: traits:: query:: evaluate_obligation:: InferCtxtExt ;
2824use crate :: traits:: util;
2925
3026impl < ' cx , ' tcx > SelectionContext < ' cx , ' tcx > {
@@ -904,54 +900,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
904900 } )
905901 }
906902
907- /// Temporary migration for #89190
908- fn need_migrate_deref_output_trait_object (
909- & mut self ,
910- ty : Ty < ' tcx > ,
911- param_env : ty:: ParamEnv < ' tcx > ,
912- cause : & ObligationCause < ' tcx > ,
913- ) -> Option < ty:: PolyExistentialTraitRef < ' tcx > > {
914- // Don't drop any candidates in intercrate mode, as it's incomplete.
915- // (Not that it matters, since `Unsize` is not a stable trait.)
916- //
917- // FIXME(@lcnr): This should probably only trigger during analysis,
918- // disabling candidates during codegen is also questionable.
919- if let TypingMode :: Coherence = self . infcx . typing_mode ( ) {
920- return None ;
921- }
922-
923- let tcx = self . tcx ( ) ;
924- if tcx. features ( ) . trait_upcasting ( ) {
925- return None ;
926- }
927-
928- // <ty as Deref>
929- let trait_ref = ty:: TraitRef :: new ( tcx, tcx. lang_items ( ) . deref_trait ( ) ?, [ ty] ) ;
930-
931- let obligation =
932- traits:: Obligation :: new ( tcx, cause. clone ( ) , param_env, ty:: Binder :: dummy ( trait_ref) ) ;
933- if !self . infcx . predicate_may_hold ( & obligation) {
934- return None ;
935- }
936-
937- self . infcx . probe ( |_| {
938- let ty = traits:: normalize_projection_ty (
939- self ,
940- param_env,
941- ty:: AliasTy :: new_from_args ( tcx, tcx. lang_items ( ) . deref_target ( ) ?, trait_ref. args ) ,
942- cause. clone ( ) ,
943- 0 ,
944- // We're *intentionally* throwing these away,
945- // since we don't actually use them.
946- & mut PredicateObligations :: new ( ) ,
947- )
948- . as_type ( )
949- . unwrap ( ) ;
950-
951- if let ty:: Dynamic ( data, ..) = ty. kind ( ) { data. principal ( ) } else { None }
952- } )
953- }
954-
955903 /// Searches for unsizing that might apply to `obligation`.
956904 fn assemble_candidates_for_unsizing (
957905 & mut self ,
@@ -1019,15 +967,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1019967 let principal_a = a_data. principal ( ) . unwrap ( ) ;
1020968 let target_trait_did = principal_def_id_b. unwrap ( ) ;
1021969 let source_trait_ref = principal_a. with_self_ty ( self . tcx ( ) , source) ;
1022- if let Some ( deref_trait_ref) = self . need_migrate_deref_output_trait_object (
1023- source,
1024- obligation. param_env ,
1025- & obligation. cause ,
1026- ) {
1027- if deref_trait_ref. def_id ( ) == target_trait_did {
1028- return ;
1029- }
1030- }
1031970
1032971 for ( idx, upcast_trait_ref) in
1033972 util:: supertraits ( self . tcx ( ) , source_trait_ref) . enumerate ( )
0 commit comments