@@ -177,7 +177,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
177177 } )
178178 }
179179
180- #[ instrument( skip( self ) ) ]
180+ #[ instrument( skip( self ) , ret ) ]
181181 fn coerce ( & self , a : Ty < ' tcx > , b : Ty < ' tcx > ) -> CoerceResult < ' tcx > {
182182 // First, remove any resolved type variables (at the top level, at least):
183183 let a = self . shallow_resolve ( a) ;
@@ -324,11 +324,10 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
324324 debug_assert ! ( self . shallow_resolve( a) == a) ;
325325 debug_assert ! ( self . shallow_resolve( b) == b) ;
326326
327- let ( r_a, mt_a) = match * a. kind ( ) {
328- ty:: Ref ( r_a, ty, mutbl) => {
329- let mt_a = ty:: TypeAndMut { ty, mutbl } ;
330- coerce_mutbls ( mt_a. mutbl , mutbl_b) ?;
331- ( r_a, mt_a)
327+ let mt_a = match * a. kind ( ) {
328+ ty:: Ref ( _, ty, mutbl) => {
329+ coerce_mutbls ( mutbl, mutbl_b) ?;
330+ ty:: TypeAndMut { ty, mutbl }
332331 }
333332 _ => return self . unify ( a, b) ,
334333 } ;
@@ -412,8 +411,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
412411 obligations. extend ( o) ;
413412 obligations. extend ( autoderef. into_obligations ( ) ) ;
414413
415- // Now apply the autoref. We have to extract the region out of
416- // the final ref type we got.
414+ // Now apply the autoref
417415 let ty:: Ref ( ..) = coerced_a. kind ( ) else {
418416 span_bug ! ( self . cause. span, "expected a ref type, got {:?}" , coerced_a) ;
419417 } ;
0 commit comments