@@ -113,7 +113,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
113
113
}
114
114
115
115
/// Unify two types (using sub or lub) and produce a noop coercion.
116
- fn unify ( & self , a : Ty < ' tcx > , b : Ty < ' tcx > ) -> CoerceResult < ' tcx > {
116
+ fn unify_and_identity ( & self , a : Ty < ' tcx > , b : Ty < ' tcx > ) -> CoerceResult < ' tcx > {
117
117
let infcx = self . fcx . infcx ( ) ;
118
118
infcx. commit_if_ok ( |_| {
119
119
let trace = TypeTrace :: types ( self . origin , false , a, b) ;
@@ -187,7 +187,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
187
187
}
188
188
_ => {
189
189
// Otherwise, just use unification rules.
190
- self . unify ( a, b)
190
+ self . unify_and_identity ( a, b)
191
191
}
192
192
}
193
193
}
@@ -219,7 +219,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
219
219
try!( coerce_mutbls ( mt_a. mutbl , mutbl_b) ) ;
220
220
( r_a, mt_a. mutbl )
221
221
}
222
- _ => return self . unify ( a, b)
222
+ _ => return self . unify_and_identity ( a, b)
223
223
} ;
224
224
225
225
let span = self . origin . span ( ) ;
@@ -251,7 +251,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
251
251
}
252
252
let ty = self . tcx ( ) . mk_ref ( r_borrow,
253
253
TypeAndMut { ty : inner_ty, mutbl : mutbl_b} ) ;
254
- match self . unify ( ty, b) {
254
+ match self . unify_and_identity ( ty, b) {
255
255
Err ( err) => {
256
256
if first_error. is_none ( ) {
257
257
first_error = Some ( err) ;
@@ -404,14 +404,14 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
404
404
match ( fn_ty_a. unsafety , fn_ty_b. unsafety ) {
405
405
( hir:: Unsafety :: Normal , hir:: Unsafety :: Unsafe ) => {
406
406
let unsafe_a = self . tcx ( ) . safe_to_unsafe_fn_ty ( fn_ty_a) ;
407
- return self . unify ( unsafe_a, b) . map ( |( ty, _) | {
407
+ return self . unify_and_identity ( unsafe_a, b) . map ( |( ty, _) | {
408
408
( ty, AdjustUnsafeFnPointer )
409
409
} ) ;
410
410
}
411
411
_ => { }
412
412
}
413
413
}
414
- self . unify ( a, b)
414
+ self . unify_and_identity ( a, b)
415
415
}
416
416
417
417
fn coerce_from_fn_item ( & self ,
@@ -430,11 +430,11 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
430
430
match b. sty {
431
431
ty:: TyFnPtr ( _) => {
432
432
let a_fn_pointer = self . tcx ( ) . mk_ty ( ty:: TyFnPtr ( fn_ty_a) ) ;
433
- self . unify ( a_fn_pointer, b) . map ( |( ty, _) | {
433
+ self . unify_and_identity ( a_fn_pointer, b) . map ( |( ty, _) | {
434
434
( ty, AdjustReifyFnPointer )
435
435
} )
436
436
}
437
- _ => self . unify ( a, b)
437
+ _ => self . unify_and_identity ( a, b)
438
438
}
439
439
}
440
440
@@ -451,13 +451,13 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
451
451
ty:: TyRef ( _, mt) => ( true , mt) ,
452
452
ty:: TyRawPtr ( mt) => ( false , mt) ,
453
453
_ => {
454
- return self . unify ( a, b) ;
454
+ return self . unify_and_identity ( a, b) ;
455
455
}
456
456
} ;
457
457
458
458
// Check that the types which they point at are compatible.
459
459
let a_unsafe = self . tcx ( ) . mk_ptr ( ty:: TypeAndMut { mutbl : mutbl_b, ty : mt_a. ty } ) ;
460
- let ( ty, noop) = try!( self . unify ( a_unsafe, b) ) ;
460
+ let ( ty, noop) = try!( self . unify_and_identity ( a_unsafe, b) ) ;
461
461
try!( coerce_mutbls ( mt_a. mutbl , mutbl_b) ) ;
462
462
463
463
// Although references and unsafe ptrs have the same
0 commit comments