@@ -179,7 +179,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
179179 } )
180180 }
181181
182- #[ instrument( skip( self ) ) ]
182+ #[ instrument( skip( self ) , ret ) ]
183183 fn coerce ( & self , a : Ty < ' tcx > , b : Ty < ' tcx > ) -> CoerceResult < ' tcx > {
184184 // First, remove any resolved type variables (at the top level, at least):
185185 let a = self . shallow_resolve ( a) ;
@@ -326,11 +326,10 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
326326 debug_assert ! ( self . shallow_resolve( a) == a) ;
327327 debug_assert ! ( self . shallow_resolve( b) == b) ;
328328
329- let ( r_a, mt_a) = match * a. kind ( ) {
330- ty:: Ref ( r_a, ty, mutbl) => {
331- let mt_a = ty:: TypeAndMut { ty, mutbl } ;
332- coerce_mutbls ( mt_a. mutbl , mutbl_b) ?;
333- ( r_a, mt_a)
329+ let mt_a = match * a. kind ( ) {
330+ ty:: Ref ( _, ty, mutbl) => {
331+ coerce_mutbls ( mutbl, mutbl_b) ?;
332+ ty:: TypeAndMut { ty, mutbl }
334333 }
335334 _ => return self . unify ( a, b) ,
336335 } ;
@@ -414,8 +413,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
414413 obligations. extend ( o) ;
415414 obligations. extend ( autoderef. into_obligations ( ) ) ;
416415
417- // Now apply the autoref. We have to extract the region out of
418- // the final ref type we got.
416+ // Now apply the autoref
419417 let ty:: Ref ( ..) = coerced_a. kind ( ) else {
420418 span_bug ! ( self . cause. span, "expected a ref type, got {:?}" , coerced_a) ;
421419 } ;
0 commit comments