@@ -218,7 +218,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
218
218
pub fn select ( & mut self , obligation : & TraitObligation < ' tcx > )
219
219
-> SelectionResult < ' tcx , Selection < ' tcx > > {
220
220
debug ! ( "select({})" , obligation. repr( self . tcx( ) ) ) ;
221
- assert ! ( !obligation. trait_ref . has_escaping_regions( ) ) ;
221
+ assert ! ( !obligation. predicate . has_escaping_regions( ) ) ;
222
222
223
223
let stack = self . push_stack ( None , obligation) ;
224
224
match try!( self . candidate_from_obligation ( & stack) ) {
@@ -280,7 +280,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
280
280
debug ! ( "evaluate_predicate_recursively({})" ,
281
281
obligation. repr( self . tcx( ) ) ) ;
282
282
283
- match obligation. trait_ref {
283
+ match obligation. predicate {
284
284
ty:: Predicate :: Trait ( ref t) => {
285
285
assert ! ( !t. has_escaping_regions( ) ) ;
286
286
let obligation = obligation. with ( t. clone ( ) ) ;
@@ -411,7 +411,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
411
411
412
412
self . infcx . probe ( |snapshot| {
413
413
let ( skol_obligation_trait_ref, skol_map) =
414
- self . infcx ( ) . skolemize_late_bound_regions ( & * obligation. trait_ref , snapshot) ;
414
+ self . infcx ( ) . skolemize_late_bound_regions ( & * obligation. predicate , snapshot) ;
415
415
match self . match_impl ( impl_def_id, obligation, snapshot,
416
416
& skol_map, Rc :: new ( skol_obligation_trait_ref) ) {
417
417
Ok ( substs) => {
@@ -456,11 +456,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
456
456
// is because we want the unbound variables to be replaced
457
457
// with fresh skolemized types starting from index 0.
458
458
let cache_fresh_trait_ref =
459
- self . infcx . freshen ( stack. obligation . trait_ref . clone ( ) ) ;
459
+ self . infcx . freshen ( stack. obligation . predicate . clone ( ) ) ;
460
460
debug ! ( "candidate_from_obligation(cache_fresh_trait_ref={}, obligation={})" ,
461
461
cache_fresh_trait_ref. repr( self . tcx( ) ) ,
462
462
stack. repr( self . tcx( ) ) ) ;
463
- assert ! ( !stack. obligation. trait_ref . has_escaping_regions( ) ) ;
463
+ assert ! ( !stack. obligation. predicate . has_escaping_regions( ) ) ;
464
464
465
465
match self . check_candidate_cache ( cache_fresh_trait_ref. clone ( ) ) {
466
466
Some ( c) => {
@@ -655,7 +655,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
655
655
// Other bounds. Consider both in-scope bounds from fn decl
656
656
// and applicable impls. There is a certain set of precedence rules here.
657
657
658
- match self . tcx ( ) . lang_items . to_builtin_kind ( obligation. trait_ref . def_id ( ) ) {
658
+ match self . tcx ( ) . lang_items . to_builtin_kind ( obligation. predicate . def_id ( ) ) {
659
659
Some ( ty:: BoundCopy ) => {
660
660
debug ! ( "obligation self ty is {}" ,
661
661
obligation. self_ty( ) . repr( self . tcx( ) ) ) ;
@@ -747,7 +747,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
747
747
candidates : & mut CandidateSet < ' tcx > )
748
748
-> Result < ( ) , SelectionError < ' tcx > >
749
749
{
750
- let kind = match self . fn_family_trait_kind ( obligation. trait_ref . def_id ( ) ) {
750
+ let kind = match self . fn_family_trait_kind ( obligation. predicate . def_id ( ) ) {
751
751
Some ( k) => k,
752
752
None => { return Ok ( ( ) ) ; }
753
753
} ;
@@ -795,7 +795,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
795
795
// We provide a `Fn` impl for fn pointers. There is no need to provide
796
796
// the other traits (e.g. `FnMut`) since those are provided by blanket
797
797
// impls.
798
- if Some ( obligation. trait_ref . def_id ( ) ) != self . tcx ( ) . lang_items . fn_trait ( ) {
798
+ if Some ( obligation. predicate . def_id ( ) ) != self . tcx ( ) . lang_items . fn_trait ( ) {
799
799
return Ok ( ( ) ) ;
800
800
}
801
801
@@ -830,11 +830,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
830
830
candidate_vec : & mut Vec < Candidate < ' tcx > > )
831
831
-> Result < ( ) , SelectionError < ' tcx > >
832
832
{
833
- let all_impls = self . all_impls ( obligation. trait_ref . def_id ( ) ) ;
833
+ let all_impls = self . all_impls ( obligation. predicate . def_id ( ) ) ;
834
834
for & impl_def_id in all_impls. iter ( ) {
835
835
self . infcx . probe ( |snapshot| {
836
836
let ( skol_obligation_trait_ref, skol_map) =
837
- self . infcx ( ) . skolemize_late_bound_regions ( & * obligation. trait_ref , snapshot) ;
837
+ self . infcx ( ) . skolemize_late_bound_regions ( & * obligation. predicate , snapshot) ;
838
838
match self . match_impl ( impl_def_id, obligation, snapshot,
839
839
& skol_map, Rc :: new ( skol_obligation_trait_ref) ) {
840
840
Ok ( _) => {
@@ -931,7 +931,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
931
931
self . infcx . probe ( |snapshot| {
932
932
let ( skol_obligation_trait_ref, skol_map) =
933
933
self . infcx ( ) . skolemize_late_bound_regions (
934
- & * stack. obligation . trait_ref , snapshot) ;
934
+ & * stack. obligation . predicate , snapshot) ;
935
935
let impl_substs =
936
936
self . rematch_impl ( impl_def_id, stack. obligation , snapshot,
937
937
& skol_map, Rc :: new ( skol_obligation_trait_ref) ) ;
@@ -987,7 +987,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
987
987
obligation : & TraitObligation < ' tcx > )
988
988
-> Result < BuiltinBoundConditions < ' tcx > , SelectionError < ' tcx > >
989
989
{
990
- let self_ty = self . infcx . shallow_resolve ( obligation. trait_ref . self_ty ( ) ) ;
990
+ let self_ty = self . infcx . shallow_resolve ( obligation. predicate . self_ty ( ) ) ;
991
991
return match self_ty. sty {
992
992
ty:: ty_infer( ty:: IntVar ( _) ) |
993
993
ty:: ty_infer( ty:: FloatVar ( _) ) |
@@ -1415,7 +1415,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1415
1415
// trait-ref. Repeat that unification now without any
1416
1416
// transactional boundary; it should not fail.
1417
1417
match self . confirm_poly_trait_refs ( obligation. cause . clone ( ) ,
1418
- obligation. trait_ref . clone ( ) ,
1418
+ obligation. predicate . clone ( ) ,
1419
1419
param. bound . clone ( ) ) {
1420
1420
Ok ( ( ) ) => Ok ( param) ,
1421
1421
Err ( _) => {
@@ -1472,7 +1472,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1472
1472
obligations. push ( Obligation {
1473
1473
cause : obligation. cause . clone ( ) ,
1474
1474
recursion_depth : obligation. recursion_depth +1 ,
1475
- trait_ref : ty:: Binder ( ty:: OutlivesPredicate ( obligation. self_ty ( ) ,
1475
+ predicate : ty:: Binder ( ty:: OutlivesPredicate ( obligation. self_ty ( ) ,
1476
1476
ty:: ReStatic ) ) . as_predicate ( ) ,
1477
1477
} ) ;
1478
1478
}
@@ -1500,7 +1500,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1500
1500
// this time not in a probe.
1501
1501
self . infcx . try ( |snapshot| {
1502
1502
let ( skol_obligation_trait_ref, skol_map) =
1503
- self . infcx ( ) . skolemize_late_bound_regions ( & * obligation. trait_ref , snapshot) ;
1503
+ self . infcx ( ) . skolemize_late_bound_regions ( & * obligation. predicate , snapshot) ;
1504
1504
let substs = self . rematch_impl ( impl_def_id, obligation,
1505
1505
snapshot, & skol_map, Rc :: new ( skol_obligation_trait_ref) ) ;
1506
1506
debug ! ( "confirm_impl_candidate substs={}" , substs) ;
@@ -1574,12 +1574,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1574
1574
vec ! [ ] ,
1575
1575
self_ty) ;
1576
1576
let trait_ref = Rc :: new ( ty:: Binder ( ty:: TraitRef {
1577
- def_id : obligation. trait_ref . def_id ( ) ,
1577
+ def_id : obligation. predicate . def_id ( ) ,
1578
1578
substs : self . tcx ( ) . mk_substs ( substs) ,
1579
1579
} ) ) ;
1580
1580
1581
1581
try!( self . confirm_poly_trait_refs ( obligation. cause . clone ( ) ,
1582
- obligation. trait_ref . clone ( ) ,
1582
+ obligation. predicate . clone ( ) ,
1583
1583
trait_ref) ) ;
1584
1584
Ok ( self_ty)
1585
1585
}
@@ -1615,7 +1615,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1615
1615
vec ! [ ] ,
1616
1616
obligation. self_ty ( ) ) ;
1617
1617
let trait_ref = Rc :: new ( ty:: Binder ( ty:: TraitRef {
1618
- def_id : obligation. trait_ref . def_id ( ) ,
1618
+ def_id : obligation. predicate . def_id ( ) ,
1619
1619
substs : self . tcx ( ) . mk_substs ( substs) ,
1620
1620
} ) ) ;
1621
1621
@@ -1624,7 +1624,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1624
1624
trait_ref. repr( self . tcx( ) ) ) ;
1625
1625
1626
1626
self . confirm_poly_trait_refs ( obligation. cause . clone ( ) ,
1627
- obligation. trait_ref . clone ( ) ,
1627
+ obligation. predicate . clone ( ) ,
1628
1628
trait_ref)
1629
1629
}
1630
1630
@@ -1769,7 +1769,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1769
1769
// substitution if we find that any of the input types, when
1770
1770
// simplified, do not match.
1771
1771
1772
- obligation. trait_ref . input_types ( ) . iter ( )
1772
+ obligation. predicate . input_types ( ) . iter ( )
1773
1773
. zip ( impl_trait_ref. input_types ( ) . iter ( ) )
1774
1774
. any ( |( & obligation_ty, & impl_ty) | {
1775
1775
let simplified_obligation_ty =
@@ -1796,7 +1796,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1796
1796
match self . infcx . sub_poly_trait_refs ( false ,
1797
1797
origin,
1798
1798
where_clause_trait_ref,
1799
- obligation. trait_ref . clone ( ) ) {
1799
+ obligation. predicate . clone ( ) ) {
1800
1800
Ok ( ( ) ) => Ok ( ( ) ) ,
1801
1801
Err ( _) => Err ( ( ) ) ,
1802
1802
}
@@ -1878,7 +1878,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1878
1878
obligation : & ' o TraitObligation < ' tcx > )
1879
1879
-> TraitObligationStack < ' o , ' tcx >
1880
1880
{
1881
- let fresh_trait_ref = obligation. trait_ref . fold_with ( & mut self . freshener ) ;
1881
+ let fresh_trait_ref = obligation. predicate . fold_with ( & mut self . freshener ) ;
1882
1882
1883
1883
TraitObligationStack {
1884
1884
obligation : obligation,
@@ -2020,7 +2020,8 @@ impl<'tcx> EvaluationResult<'tcx> {
2020
2020
EvaluatedToOk |
2021
2021
EvaluatedToAmbig |
2022
2022
EvaluatedToErr ( Overflow ) |
2023
- EvaluatedToErr ( OutputTypeParameterMismatch ( ..) ) => {
2023
+ EvaluatedToErr ( OutputTypeParameterMismatch ( ..) ) |
2024
+ EvaluatedToErr ( ProjectionMismatch ( ..) ) => {
2024
2025
true
2025
2026
}
2026
2027
EvaluatedToErr ( Unimplemented ) => {
0 commit comments