@@ -9,30 +9,32 @@ use crate::constraints::OutlivesConstraint;
9
9
use crate :: diagnostics:: UniverseInfo ;
10
10
use crate :: type_check:: { Locations , TypeChecker } ;
11
11
12
- /// Adds sufficient constraints to ensure that `a R b` where `R` depends on `v`:
13
- ///
14
- /// - "Covariant" `a <: b`
15
- /// - "Invariant" `a == b`
16
- /// - "Contravariant" `a :> b`
17
- ///
18
- /// N.B., the type `a` is permitted to have unresolved inference
19
- /// variables, but not the type `b`.
20
- #[ instrument( skip( type_checker) , level = "debug" ) ]
21
- pub ( super ) fn relate_types < ' tcx > (
22
- type_checker : & mut TypeChecker < ' _ , ' tcx > ,
23
- a : Ty < ' tcx > ,
24
- v : ty:: Variance ,
25
- b : Ty < ' tcx > ,
26
- locations : Locations ,
27
- category : ConstraintCategory ,
28
- ) -> Fallible < ( ) > {
29
- TypeRelating :: new (
30
- type_checker. infcx ,
31
- NllTypeRelatingDelegate :: new ( type_checker, locations, category, UniverseInfo :: relate ( a, b) ) ,
32
- v,
33
- )
34
- . relate ( a, b) ?;
35
- Ok ( ( ) )
12
+ impl < ' a , ' tcx > TypeChecker < ' a , ' tcx > {
13
+ /// Adds sufficient constraints to ensure that `a R b` where `R` depends on `v`:
14
+ ///
15
+ /// - "Covariant" `a <: b`
16
+ /// - "Invariant" `a == b`
17
+ /// - "Contravariant" `a :> b`
18
+ ///
19
+ /// N.B., the type `a` is permitted to have unresolved inference
20
+ /// variables, but not the type `b`.
21
+ #[ instrument( skip( self ) , level = "debug" ) ]
22
+ pub ( super ) fn relate_types (
23
+ & mut self ,
24
+ a : Ty < ' tcx > ,
25
+ v : ty:: Variance ,
26
+ b : Ty < ' tcx > ,
27
+ locations : Locations ,
28
+ category : ConstraintCategory ,
29
+ ) -> Fallible < ( ) > {
30
+ TypeRelating :: new (
31
+ self . infcx ,
32
+ NllTypeRelatingDelegate :: new ( self , locations, category, UniverseInfo :: relate ( a, b) ) ,
33
+ v,
34
+ )
35
+ . relate ( a, b) ?;
36
+ Ok ( ( ) )
37
+ }
36
38
}
37
39
38
40
struct NllTypeRelatingDelegate < ' me , ' bccx , ' tcx > {
0 commit comments