@@ -1613,6 +1613,12 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
16131613 self . add_reborrow_constraint ( location, * region, borrowed_place) ;
16141614 }
16151615
1616+ Rvalue :: Reborrow ( ..) => {
1617+ // Reborrow needs to produce a relation between the source and destination fields,
1618+ // which means that we have had to already handle this in visit_assign.
1619+ unreachable ! ( )
1620+ }
1621+
16161622 Rvalue :: BinaryOp (
16171623 BinOp :: Eq | BinOp :: Ne | BinOp :: Lt | BinOp :: Le | BinOp :: Gt | BinOp :: Ge ,
16181624 box ( left, right) ,
@@ -1690,8 +1696,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
16901696 | Rvalue :: BinaryOp ( ..)
16911697 | Rvalue :: RawPtr ( ..)
16921698 | Rvalue :: ThreadLocalRef ( ..)
1693- | Rvalue :: Discriminant ( ..)
1694- | Rvalue :: Reborrow ( ..) => { }
1699+ | Rvalue :: Discriminant ( ..) => { }
16951700 }
16961701 }
16971702
@@ -2250,15 +2255,15 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
22502255 | Rvalue :: ThreadLocalRef ( _)
22512256 | Rvalue :: Repeat ( ..)
22522257 | Rvalue :: Ref ( ..)
2258+ | Rvalue :: Reborrow ( ..)
22532259 | Rvalue :: RawPtr ( ..)
22542260 | Rvalue :: Cast ( ..)
22552261 | Rvalue :: ShallowInitBox ( ..)
22562262 | Rvalue :: BinaryOp ( ..)
22572263 | Rvalue :: CopyForDeref ( ..)
22582264 | Rvalue :: UnaryOp ( ..)
22592265 | Rvalue :: Discriminant ( ..)
2260- | Rvalue :: WrapUnsafeBinder ( ..)
2261- | Rvalue :: Reborrow ( ..) => None ,
2266+ | Rvalue :: WrapUnsafeBinder ( ..) => None ,
22622267
22632268 Rvalue :: Aggregate ( aggregate, _) => match * * aggregate {
22642269 AggregateKind :: Adt ( _, _, _, user_ty, _) => user_ty,
@@ -2464,7 +2469,8 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
24642469 borrowed_place : & Place < ' tcx > ,
24652470 ) {
24662471 // These constraints are only meaningful during borrowck:
2467- let Self { borrow_set, location_table, polonius_facts, constraints, infcx, body, .. } = self ;
2472+ let Self { borrow_set, location_table, polonius_facts, constraints, infcx, body, .. } =
2473+ self ;
24682474
24692475 // If we are reborrowing the referent of another reference, we
24702476 // need to add outlives relationships. In a case like `&mut
0 commit comments