@@ -3,7 +3,6 @@ use crate::errors::CtorIsPrivate;
3
3
use crate :: method:: { self , MethodCallee , SelfSource } ;
4
4
use crate :: rvalue_scopes;
5
5
use crate :: { BreakableCtxt , Diverges , Expectation , FnCtxt , LoweredTy } ;
6
- use rustc_data_structures:: captures:: Captures ;
7
6
use rustc_data_structures:: fx:: FxHashSet ;
8
7
use rustc_errors:: { Applicability , Diag , ErrorGuaranteed , MultiSpan , StashKey } ;
9
8
use rustc_hir as hir;
@@ -636,64 +635,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
636
635
ret_ty. builtin_deref ( true ) . unwrap ( )
637
636
}
638
637
639
- #[ instrument( skip( self ) , level = "debug" ) ]
640
- fn self_type_matches_expected_vid ( & self , self_ty : Ty < ' tcx > , expected_vid : ty:: TyVid ) -> bool {
641
- let self_ty = self . shallow_resolve ( self_ty) ;
642
- debug ! ( ?self_ty) ;
643
-
644
- match * self_ty. kind ( ) {
645
- ty:: Infer ( ty:: TyVar ( found_vid) ) => {
646
- let found_vid = self . root_var ( found_vid) ;
647
- debug ! ( "self_type_matches_expected_vid - found_vid={:?}" , found_vid) ;
648
- expected_vid == found_vid
649
- }
650
- _ => false ,
651
- }
652
- }
653
-
654
- #[ instrument( skip( self ) , level = "debug" ) ]
655
- pub ( in super :: super ) fn obligations_for_self_ty < ' b > (
656
- & ' b self ,
657
- self_ty : ty:: TyVid ,
658
- ) -> impl DoubleEndedIterator < Item = traits:: PredicateObligation < ' tcx > > + Captures < ' tcx > + ' b
659
- {
660
- let ty_var_root = self . root_var ( self_ty) ;
661
- trace ! ( "pending_obligations = {:#?}" , self . fulfillment_cx. borrow( ) . pending_obligations( ) ) ;
662
-
663
- self . fulfillment_cx . borrow ( ) . pending_obligations ( ) . into_iter ( ) . filter_map (
664
- move |obligation| match & obligation. predicate . kind ( ) . skip_binder ( ) {
665
- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Projection ( data) )
666
- if self . self_type_matches_expected_vid (
667
- data. projection_ty . self_ty ( ) ,
668
- ty_var_root,
669
- ) =>
670
- {
671
- Some ( obligation)
672
- }
673
- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Trait ( data) )
674
- if self . self_type_matches_expected_vid ( data. self_ty ( ) , ty_var_root) =>
675
- {
676
- Some ( obligation)
677
- }
678
-
679
- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Trait ( ..) )
680
- | ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Projection ( ..) )
681
- | ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstArgHasType ( ..) )
682
- | ty:: PredicateKind :: Subtype ( ..)
683
- | ty:: PredicateKind :: Coerce ( ..)
684
- | ty:: PredicateKind :: Clause ( ty:: ClauseKind :: RegionOutlives ( ..) )
685
- | ty:: PredicateKind :: Clause ( ty:: ClauseKind :: TypeOutlives ( ..) )
686
- | ty:: PredicateKind :: Clause ( ty:: ClauseKind :: WellFormed ( ..) )
687
- | ty:: PredicateKind :: ObjectSafe ( ..)
688
- | ty:: PredicateKind :: NormalizesTo ( ..)
689
- | ty:: PredicateKind :: AliasRelate ( ..)
690
- | ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstEvaluatable ( ..) )
691
- | ty:: PredicateKind :: ConstEquate ( ..)
692
- | ty:: PredicateKind :: Ambiguous => None ,
693
- } ,
694
- )
695
- }
696
-
697
638
pub ( in super :: super ) fn type_var_is_sized ( & self , self_ty : ty:: TyVid ) -> bool {
698
639
let sized_did = self . tcx . lang_items ( ) . sized_trait ( ) ;
699
640
self . obligations_for_self_ty ( self_ty) . any ( |obligation| {
0 commit comments