@@ -79,7 +79,7 @@ impl<'a, 'tcx> MismatchRelation<'a, 'tcx> {
79
79
let old_ty = self . tcx . type_of ( old_def_id) ;
80
80
let new_ty = self . tcx . type_of ( new_def_id) ;
81
81
debug ! ( "relating item pair" ) ;
82
- let _ = self . relate ( & old_ty, & new_ty) ;
82
+ let _ = self . relate ( old_ty, new_ty) ;
83
83
}
84
84
}
85
85
@@ -118,13 +118,13 @@ impl<'a, 'tcx> TypeRelation<'tcx> for MismatchRelation<'a, 'tcx> {
118
118
fn relate_with_variance < T : Relate < ' tcx > > (
119
119
& mut self ,
120
120
_: ty:: Variance ,
121
- a : & T ,
122
- b : & T ,
121
+ a : T ,
122
+ b : T ,
123
123
) -> RelateResult < ' tcx , T > {
124
124
self . relate ( a, b)
125
125
}
126
126
127
- fn relate < T : Relate < ' tcx > > ( & mut self , a : & T , b : & T ) -> RelateResult < ' tcx , T > {
127
+ fn relate < T : Relate < ' tcx > > ( & mut self , a : T , b : T ) -> RelateResult < ' tcx , T > {
128
128
debug ! ( "relate: mismatch relation: a: {:?}, b: {:?}" , a, b) ;
129
129
Relate :: relate ( self , a, b)
130
130
}
@@ -135,7 +135,7 @@ impl<'a, 'tcx> TypeRelation<'tcx> for MismatchRelation<'a, 'tcx> {
135
135
use rustc_middle:: ty:: TyKind ;
136
136
137
137
if self . current_old_types . contains ( a) || self . current_new_types . contains ( b) {
138
- return Ok ( self . tcx . types . err ) ;
138
+ return Ok ( self . tcx . ty_error ( ) ) ;
139
139
}
140
140
141
141
self . current_old_types . insert ( a) ;
@@ -161,7 +161,7 @@ impl<'a, 'tcx> TypeRelation<'tcx> for MismatchRelation<'a, 'tcx> {
161
161
{
162
162
let b_field_ty = b_field. ty ( self . tcx , b_substs) ;
163
163
164
- let _ = self . relate ( & a_field_ty, & b_field_ty) ?;
164
+ let _ = self . relate ( a_field_ty, b_field_ty) ?;
165
165
}
166
166
}
167
167
@@ -188,16 +188,16 @@ impl<'a, 'tcx> TypeRelation<'tcx> for MismatchRelation<'a, 'tcx> {
188
188
}
189
189
( & TyKind :: Array ( a_t, _) , & TyKind :: Array ( b_t, _) )
190
190
| ( & TyKind :: Slice ( a_t) , & TyKind :: Slice ( b_t) ) => {
191
- let _ = self . relate ( & a_t, & b_t) ?;
191
+ let _ = self . relate ( a_t, b_t) ?;
192
192
None
193
193
}
194
194
( & TyKind :: RawPtr ( a_mt) , & TyKind :: RawPtr ( b_mt) ) => {
195
- let _ = self . relate ( & a_mt, & b_mt) ?;
195
+ let _ = self . relate ( a_mt, b_mt) ?;
196
196
None
197
197
}
198
198
( & TyKind :: Ref ( a_r, a_ty, _) , & TyKind :: Ref ( b_r, b_ty, _) ) => {
199
- let _ = self . relate ( & a_r, & b_r) ?;
200
- let _ = self . relate ( & a_ty, & b_ty) ?;
199
+ let _ = self . relate ( a_r, b_r) ?;
200
+ let _ = self . relate ( a_ty, b_ty) ?;
201
201
None
202
202
}
203
203
( & TyKind :: FnDef ( a_def_id, a_substs) , & TyKind :: FnDef ( b_def_id, b_substs) ) => {
@@ -214,17 +214,17 @@ impl<'a, 'tcx> TypeRelation<'tcx> for MismatchRelation<'a, 'tcx> {
214
214
Some ( ( a, b) )
215
215
}
216
216
( & TyKind :: FnPtr ( a_fty) , & TyKind :: FnPtr ( b_fty) ) => {
217
- let _ = self . relate ( & a_fty, & b_fty) ?;
217
+ let _ = self . relate ( a_fty, b_fty) ?;
218
218
None
219
219
}
220
220
( & TyKind :: Dynamic ( a_obj, a_r) , & TyKind :: Dynamic ( b_obj, b_r) ) => {
221
- let _ = self . relate ( & a_r, & b_r) ?;
221
+ let _ = self . relate ( a_r, b_r) ?;
222
222
let a = a_obj. principal ( ) ;
223
223
let b = b_obj. principal ( ) ;
224
224
225
225
if let ( Some ( a) , Some ( b) ) = ( a, b) {
226
226
if self . check_substs ( a. skip_binder ( ) . substs , b. skip_binder ( ) . substs ) {
227
- let _ = self . relate ( & a. skip_binder ( ) . substs , & b. skip_binder ( ) . substs ) ?;
227
+ let _ = self . relate ( a. skip_binder ( ) . substs , b. skip_binder ( ) . substs ) ?;
228
228
let a = Res :: Def ( DefKind :: Trait , a. skip_binder ( ) . def_id ) ;
229
229
let b = Res :: Def ( DefKind :: Trait , b. skip_binder ( ) . def_id ) ;
230
230
Some ( ( a, b) )
@@ -236,11 +236,11 @@ impl<'a, 'tcx> TypeRelation<'tcx> for MismatchRelation<'a, 'tcx> {
236
236
}
237
237
}
238
238
( & TyKind :: Tuple ( as_) , & TyKind :: Tuple ( bs) ) => {
239
- let _ = as_. iter ( ) . zip ( bs) . map ( |( a, b) | self . relate ( & a, & b) ) ;
239
+ let _ = as_. iter ( ) . zip ( bs) . map ( |( a, b) | self . relate ( a, b) ) ;
240
240
None
241
241
}
242
242
( & TyKind :: Projection ( a_data) , & TyKind :: Projection ( b_data) ) => {
243
- let _ = self . relate ( & a_data, & b_data) ?;
243
+ let _ = self . relate ( a_data, b_data) ?;
244
244
245
245
let a = Res :: Def ( DefKind :: AssocTy , a_data. item_def_id ) ;
246
246
let b = Res :: Def ( DefKind :: AssocTy , b_data. item_def_id ) ;
@@ -279,7 +279,7 @@ impl<'a, 'tcx> TypeRelation<'tcx> for MismatchRelation<'a, 'tcx> {
279
279
}
280
280
}
281
281
282
- Ok ( self . tcx . types . err )
282
+ Ok ( self . tcx . ty_error ( ) )
283
283
}
284
284
285
285
fn regions (
@@ -300,8 +300,8 @@ impl<'a, 'tcx> TypeRelation<'tcx> for MismatchRelation<'a, 'tcx> {
300
300
301
301
fn binders < T : Relate < ' tcx > > (
302
302
& mut self ,
303
- a : & ty:: Binder < T > ,
304
- b : & ty:: Binder < T > ,
303
+ a : ty:: Binder < T > ,
304
+ b : ty:: Binder < T > ,
305
305
) -> RelateResult < ' tcx , ty:: Binder < T > > {
306
306
Ok ( ty:: Binder :: bind (
307
307
self . relate ( a. skip_binder ( ) , b. skip_binder ( ) ) ?,
0 commit comments