|
9 | 9 | use hir::def_id::DefId;
|
10 | 10 | use hir::LangItem;
|
11 | 11 | use rustc_hir as hir;
|
12 |
| -use rustc_infer::traits::ObligationCause; |
13 | 12 | use rustc_infer::traits::{Obligation, PolyTraitObligation, SelectionError};
|
14 | 13 | use rustc_middle::ty::fast_reject::{DeepRejectCtxt, TreatParams};
|
15 | 14 | use rustc_middle::ty::{self, Ty, TypeVisitableExt};
|
16 | 15 |
|
17 |
| -use crate::traits; |
18 |
| -use crate::traits::query::evaluate_obligation::InferCtxtExt; |
19 | 16 | use crate::traits::util;
|
20 | 17 |
|
21 | 18 | use super::BuiltinImplConditions;
|
@@ -690,45 +687,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
690 | 687 | })
|
691 | 688 | }
|
692 | 689 |
|
693 |
| - /// Temporary migration for #89190 |
694 |
| - fn need_migrate_deref_output_trait_object( |
695 |
| - &mut self, |
696 |
| - ty: Ty<'tcx>, |
697 |
| - param_env: ty::ParamEnv<'tcx>, |
698 |
| - cause: &ObligationCause<'tcx>, |
699 |
| - ) -> Option<ty::PolyExistentialTraitRef<'tcx>> { |
700 |
| - let tcx = self.tcx(); |
701 |
| - if tcx.features().trait_upcasting { |
702 |
| - return None; |
703 |
| - } |
704 |
| - |
705 |
| - // <ty as Deref> |
706 |
| - let trait_ref = ty::TraitRef::new(tcx, tcx.lang_items().deref_trait()?, [ty]); |
707 |
| - |
708 |
| - let obligation = |
709 |
| - traits::Obligation::new(tcx, cause.clone(), param_env, ty::Binder::dummy(trait_ref)); |
710 |
| - if !self.infcx.predicate_may_hold(&obligation) { |
711 |
| - return None; |
712 |
| - } |
713 |
| - |
714 |
| - self.infcx.probe(|_| { |
715 |
| - let ty = traits::normalize_projection_type( |
716 |
| - self, |
717 |
| - param_env, |
718 |
| - ty::AliasTy::new(tcx, tcx.lang_items().deref_target()?, trait_ref.args), |
719 |
| - cause.clone(), |
720 |
| - 0, |
721 |
| - // We're *intentionally* throwing these away, |
722 |
| - // since we don't actually use them. |
723 |
| - &mut vec![], |
724 |
| - ) |
725 |
| - .ty() |
726 |
| - .unwrap(); |
727 |
| - |
728 |
| - if let ty::Dynamic(data, ..) = ty.kind() { data.principal() } else { None } |
729 |
| - }) |
730 |
| - } |
731 |
| - |
732 | 690 | /// Searches for unsizing that might apply to `obligation`.
|
733 | 691 | fn assemble_candidates_for_unsizing(
|
734 | 692 | &mut self,
|
@@ -786,15 +744,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
786 | 744 | let principal_a = a_data.principal().unwrap();
|
787 | 745 | let target_trait_did = principal_def_id_b.unwrap();
|
788 | 746 | let source_trait_ref = principal_a.with_self_ty(self.tcx(), source);
|
789 |
| - if let Some(deref_trait_ref) = self.need_migrate_deref_output_trait_object( |
790 |
| - source, |
791 |
| - obligation.param_env, |
792 |
| - &obligation.cause, |
793 |
| - ) { |
794 |
| - if deref_trait_ref.def_id() == target_trait_did { |
795 |
| - return; |
796 |
| - } |
797 |
| - } |
798 | 747 |
|
799 | 748 | for (idx, upcast_trait_ref) in
|
800 | 749 | util::supertraits(self.tcx(), source_trait_ref).enumerate()
|
|
0 commit comments