@@ -211,12 +211,9 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
211
211
ty:: RawPtr ( mt_b) => {
212
212
return self . coerce_unsafe_ptr ( a, b, mt_b. mutbl ) ;
213
213
}
214
-
215
- ty:: Ref ( r_b, ty, mutbl) => {
216
- let mt_b = ty:: TypeAndMut { ty, mutbl } ;
217
- return self . coerce_borrowed_pointer ( a, b, r_b, mt_b) ;
214
+ ty:: Ref ( r_b, _, mutbl_b) => {
215
+ return self . coerce_borrowed_pointer ( a, b, r_b, mutbl_b) ;
218
216
}
219
-
220
217
_ => { }
221
218
}
222
219
@@ -255,7 +252,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
255
252
a : Ty < ' tcx > ,
256
253
b : Ty < ' tcx > ,
257
254
r_b : ty:: Region < ' tcx > ,
258
- mt_b : TypeAndMut < ' tcx > ,
255
+ mutbl_b : hir :: Mutability ,
259
256
) -> CoerceResult < ' tcx > {
260
257
debug ! ( "coerce_borrowed_pointer(a={:?}, b={:?})" , a, b) ;
261
258
@@ -268,7 +265,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
268
265
let ( r_a, mt_a) = match a. kind {
269
266
ty:: Ref ( r_a, ty, mutbl) => {
270
267
let mt_a = ty:: TypeAndMut { ty, mutbl } ;
271
- coerce_mutbls ( mt_a. mutbl , mt_b . mutbl ) ?;
268
+ coerce_mutbls ( mt_a. mutbl , mutbl_b ) ?;
272
269
( r_a, mt_a)
273
270
}
274
271
_ => return self . unify_and ( a, b, identity) ,
@@ -364,7 +361,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
364
361
r_a // [3] above
365
362
} else {
366
363
if r_borrow_var. is_none ( ) {
367
- // create var lazilly , at most once
364
+ // create var lazily , at most once
368
365
let coercion = Coercion ( span) ;
369
366
let r = self . next_region_var ( coercion) ;
370
367
r_borrow_var = Some ( r) ; // [4] above
@@ -375,7 +372,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
375
372
r,
376
373
TypeAndMut {
377
374
ty : referent_ty,
378
- mutbl : mt_b . mutbl , // [1] above
375
+ mutbl : mutbl_b , // [1] above
379
376
} ,
380
377
) ;
381
378
match self . unify ( derefd_ty_a, b) {
@@ -417,11 +414,11 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
417
414
// `self.x` both have `&mut `type would be a move of
418
415
// `self.x`, but we auto-coerce it to `foo(&mut *self.x)`,
419
416
// which is a borrow.
420
- assert_eq ! ( mt_b . mutbl , hir:: Mutability :: Not ) ; // can only coerce &T -> &U
417
+ assert_eq ! ( mutbl_b , hir:: Mutability :: Not ) ; // can only coerce &T -> &U
421
418
return success ( vec ! [ ] , ty, obligations) ;
422
419
}
423
420
424
- let needs = Needs :: maybe_mut_place ( mt_b . mutbl ) ;
421
+ let needs = Needs :: maybe_mut_place ( mutbl_b ) ;
425
422
let InferOk { value : mut adjustments, obligations : o } =
426
423
autoderef. adjust_steps_as_infer_ok ( self , needs) ;
427
424
obligations. extend ( o) ;
@@ -433,7 +430,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
433
430
ty:: Ref ( r_borrow, _, _) => r_borrow,
434
431
_ => span_bug ! ( span, "expected a ref type, got {:?}" , ty) ,
435
432
} ;
436
- let mutbl = match mt_b . mutbl {
433
+ let mutbl = match mutbl_b {
437
434
hir:: Mutability :: Not => AutoBorrowMutability :: Not ,
438
435
hir:: Mutability :: Mut => {
439
436
AutoBorrowMutability :: Mut { allow_two_phase_borrow : self . allow_two_phase }
0 commit comments