@@ -62,28 +62,28 @@ impl<I: Interner> InferenceTable<I> {
62
62
}
63
63
64
64
/// Variant on `instantiate_in` that takes a `Binders<T>`.
65
- pub ( crate ) fn instantiate_binders_existentially < T > (
65
+ pub ( crate ) fn instantiate_binders_existentially < ' a , T > (
66
66
& mut self ,
67
- interner : & I ,
68
- arg : impl IntoBindersAndValue < Value = T > ,
67
+ interner : & ' a I ,
68
+ arg : impl IntoBindersAndValue < ' a , I , Value = T > ,
69
69
) -> T :: Result
70
70
where
71
71
T : Fold < I > ,
72
72
{
73
- let ( binders, value) = arg. into_binders_and_value ( ) ;
73
+ let ( binders, value) = arg. into_binders_and_value ( interner ) ;
74
74
let max_universe = self . max_universe ;
75
75
self . instantiate_in ( interner, max_universe, binders, & value)
76
76
}
77
77
78
- pub ( crate ) fn instantiate_binders_universally < T > (
78
+ pub ( crate ) fn instantiate_binders_universally < ' a , T > (
79
79
& mut self ,
80
- interner : & I ,
81
- arg : impl IntoBindersAndValue < Value = T > ,
80
+ interner : & ' a I ,
81
+ arg : impl IntoBindersAndValue < ' a , I , Value = T > ,
82
82
) -> T :: Result
83
83
where
84
84
T : Fold < I > ,
85
85
{
86
- let ( binders, value) = arg. into_binders_and_value ( ) ;
86
+ let ( binders, value) = arg. into_binders_and_value ( interner ) ;
87
87
let ui = self . new_universe ( ) ;
88
88
let parameters: Vec < _ > = binders
89
89
. into_iter ( )
@@ -103,34 +103,34 @@ impl<I: Interner> InferenceTable<I> {
103
103
}
104
104
}
105
105
106
- pub ( crate ) trait IntoBindersAndValue {
106
+ pub ( crate ) trait IntoBindersAndValue < ' a , I : Interner > {
107
107
type Binders : IntoIterator < Item = ParameterKind < ( ) > > ;
108
108
type Value ;
109
109
110
- fn into_binders_and_value ( self ) -> ( Self :: Binders , Self :: Value ) ;
110
+ fn into_binders_and_value ( self , interner : & ' a I ) -> ( Self :: Binders , Self :: Value ) ;
111
111
}
112
112
113
- impl < ' a , I , T > IntoBindersAndValue for ( & ' a Binders < T > , & ' a I )
113
+ impl < ' a , I , T > IntoBindersAndValue < ' a , I > for & ' a Binders < T >
114
114
where
115
115
I : Interner ,
116
116
T : HasInterner < Interner = I > ,
117
117
{
118
118
type Binders = std:: iter:: Cloned < std:: slice:: Iter < ' a , ParameterKind < ( ) > > > ;
119
119
type Value = & ' a T ;
120
120
121
- fn into_binders_and_value ( self ) -> ( Self :: Binders , Self :: Value ) {
122
- ( self . 0 . binders . iter ( self . 1 ) . cloned ( ) , self . 0 . skip_binders ( ) )
121
+ fn into_binders_and_value ( self , interner : & ' a I ) -> ( Self :: Binders , Self :: Value ) {
122
+ ( self . binders . iter ( interner ) . cloned ( ) , self . skip_binders ( ) )
123
123
}
124
124
}
125
125
126
- impl < ' a , I > IntoBindersAndValue for & ' a Fn < I >
126
+ impl < ' a , I > IntoBindersAndValue < ' a , I > for & ' a Fn < I >
127
127
where
128
128
I : Interner ,
129
129
{
130
130
type Binders = std:: iter:: Map < std:: ops:: Range < usize > , fn ( usize ) -> chalk_ir:: ParameterKind < ( ) > > ;
131
131
type Value = & ' a Substitution < I > ;
132
132
133
- fn into_binders_and_value ( self ) -> ( Self :: Binders , Self :: Value ) {
133
+ fn into_binders_and_value ( self , _interner : & ' a I ) -> ( Self :: Binders , Self :: Value ) {
134
134
fn make_lifetime ( _: usize ) -> ParameterKind < ( ) > {
135
135
ParameterKind :: Lifetime ( ( ) )
136
136
}
@@ -140,11 +140,11 @@ where
140
140
}
141
141
}
142
142
143
- impl < ' a , T > IntoBindersAndValue for ( & ' a Vec < ParameterKind < ( ) > > , & ' a T ) {
143
+ impl < ' a , T , I : Interner > IntoBindersAndValue < ' a , I > for ( & ' a Vec < ParameterKind < ( ) > > , & ' a T ) {
144
144
type Binders = std:: iter:: Cloned < std:: slice:: Iter < ' a , ParameterKind < ( ) > > > ;
145
145
type Value = & ' a T ;
146
146
147
- fn into_binders_and_value ( self ) -> ( Self :: Binders , Self :: Value ) {
147
+ fn into_binders_and_value ( self , _interner : & ' a I ) -> ( Self :: Binders , Self :: Value ) {
148
148
( self . 0 . iter ( ) . cloned ( ) , & self . 1 )
149
149
}
150
150
}
0 commit comments