@@ -551,8 +551,8 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
551551
552552impl < ' a , ' tcx > Visitor < ' tcx > for TypeChecker < ' a , ' tcx > {
553553 fn visit_assign ( & mut self , place : & Place < ' tcx > , rvalue : & Rvalue < ' tcx > , location : Location ) {
554- // check rvalue is Reborrow
555- if let Rvalue :: Reborrow ( mutability , rvalue ) = rvalue {
554+ if let Rvalue :: Reborrow ( mutability , rvalue, _ ) = rvalue {
555+ // check rvalue is Reborrow
556556 self . add_generic_reborrow_constraint ( * mutability, location, place, rvalue) ;
557557 } else {
558558 // rest of the cases
@@ -637,11 +637,11 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
637637 debug ! ( ?rv_ty) ;
638638 let rv_ty = self . normalize ( rv_ty, location) ;
639639 debug ! ( "normalized rv_ty: {:?}" , rv_ty) ;
640- // Note: we've checked Reborrow/CoerceShared type matches
641- // separately in fn visit_assign.
642- if ! matches ! ( rv , Rvalue :: Reborrow ( _ , _ ) )
643- && let Err ( terr) =
644- self . sub_types ( rv_ty, place_ty, location. to_locations ( ) , category)
640+ if let Rvalue :: Reborrow ( mutability , rvalue , _ ) = rv {
641+ // check rvalue is Reborrow
642+ self . add_generic_reborrow_constraint ( * mutability , location , place , rvalue ) ;
643+ } else if let Err ( terr) =
644+ self . sub_types ( rv_ty, place_ty, location. to_locations ( ) , category)
645645 {
646646 span_mirbug ! (
647647 self ,
0 commit comments