@@ -15,25 +15,20 @@ use super::Subtype;
15
15
16
16
use ty:: { self , Ty , TyCtxt } ;
17
17
use ty:: relate:: { Relate , RelateResult , TypeRelation } ;
18
- use traits:: PredicateObligations ;
19
18
20
19
/// "Greatest lower bound" (common subtype)
21
- pub struct Glb < ' infcx , ' gcx : ' infcx +' tcx , ' tcx : ' infcx > {
22
- fields : CombineFields < ' infcx , ' gcx , ' tcx > ,
20
+ pub struct Glb < ' combine , ' infcx : ' combine , ' gcx : ' infcx +' tcx , ' tcx : ' infcx > {
21
+ fields : & ' combine mut CombineFields < ' infcx , ' gcx , ' tcx > ,
23
22
a_is_expected : bool ,
24
23
}
25
24
26
- impl < ' infcx , ' gcx , ' tcx > Glb < ' infcx , ' gcx , ' tcx > {
27
- pub fn new ( fields : CombineFields < ' infcx , ' gcx , ' tcx > , a_is_expected : bool ) -> Glb < ' infcx , ' gcx , ' tcx > {
25
+ impl < ' combine , ' infcx , ' gcx , ' tcx > Glb < ' combine , ' infcx , ' gcx , ' tcx > {
26
+ pub fn new ( fields : & ' combine mut CombineFields < ' infcx , ' gcx , ' tcx > , a_is_expected : bool ) -> Glb < ' combine , ' infcx , ' gcx , ' tcx > {
28
27
Glb { fields : fields, a_is_expected : a_is_expected }
29
28
}
30
-
31
- pub fn obligations ( self ) -> PredicateObligations < ' tcx > {
32
- self . fields . obligations
33
- }
34
29
}
35
30
36
- impl < ' infcx , ' gcx , ' tcx > TypeRelation < ' infcx , ' gcx , ' tcx > for Glb < ' infcx , ' gcx , ' tcx > {
31
+ impl < ' combine , ' infcx , ' gcx , ' tcx > TypeRelation < ' infcx , ' gcx , ' tcx > for Glb < ' combine , ' infcx , ' gcx , ' tcx > {
37
32
fn tag ( & self ) -> & ' static str { "Glb" }
38
33
39
34
fn tcx ( & self ) -> TyCtxt < ' infcx , ' gcx , ' tcx > { self . fields . tcx ( ) }
@@ -76,12 +71,12 @@ impl<'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx> for Glb<'infcx, 'gcx,
76
71
}
77
72
}
78
73
79
- impl < ' infcx , ' gcx , ' tcx > LatticeDir < ' infcx , ' gcx , ' tcx > for Glb < ' infcx , ' gcx , ' tcx > {
74
+ impl < ' combine , ' infcx , ' gcx , ' tcx > LatticeDir < ' infcx , ' gcx , ' tcx > for Glb < ' combine , ' infcx , ' gcx , ' tcx > {
80
75
fn infcx ( & self ) -> & ' infcx InferCtxt < ' infcx , ' gcx , ' tcx > {
81
76
self . fields . infcx
82
77
}
83
78
84
- fn relate_bound ( & self , v : Ty < ' tcx > , a : Ty < ' tcx > , b : Ty < ' tcx > ) -> RelateResult < ' tcx , ( ) > {
79
+ fn relate_bound ( & mut self , v : Ty < ' tcx > , a : Ty < ' tcx > , b : Ty < ' tcx > ) -> RelateResult < ' tcx , ( ) > {
85
80
let mut sub = self . fields . sub ( self . a_is_expected ) ;
86
81
sub. relate ( & v, & a) ?;
87
82
sub. relate ( & v, & b) ?;
0 commit comments