@@ -1300,7 +1300,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1300
1300
match & term. kind {
1301
1301
TerminatorKind :: Goto { .. }
1302
1302
| TerminatorKind :: Resume
1303
- | TerminatorKind :: Abort
1303
+ | TerminatorKind :: Terminate
1304
1304
| TerminatorKind :: Return
1305
1305
| TerminatorKind :: GeneratorDrop
1306
1306
| TerminatorKind :: Unreachable
@@ -1584,7 +1584,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1584
1584
span_mirbug ! ( self , block_data, "resume on non-cleanup block!" )
1585
1585
}
1586
1586
}
1587
- TerminatorKind :: Abort => {
1587
+ TerminatorKind :: Terminate => {
1588
1588
if !is_cleanup {
1589
1589
span_mirbug ! ( self , block_data, "abort on non-cleanup block!" )
1590
1590
}
@@ -1610,49 +1610,29 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1610
1610
}
1611
1611
TerminatorKind :: Unreachable => { }
1612
1612
TerminatorKind :: Drop { target, unwind, .. }
1613
- | TerminatorKind :: Assert { target, cleanup : unwind, .. } => {
1613
+ | TerminatorKind :: Assert { target, unwind, .. } => {
1614
1614
self . assert_iscleanup ( body, block_data, target, is_cleanup) ;
1615
- if let Some ( unwind) = unwind {
1616
- if is_cleanup {
1617
- span_mirbug ! ( self , block_data, "unwind on cleanup block" )
1618
- }
1619
- self . assert_iscleanup ( body, block_data, unwind, true ) ;
1620
- }
1615
+ self . assert_iscleanup_unwind ( body, block_data, unwind, is_cleanup) ;
1621
1616
}
1622
- TerminatorKind :: Call { ref target, cleanup , .. } => {
1617
+ TerminatorKind :: Call { ref target, unwind , .. } => {
1623
1618
if let & Some ( target) = target {
1624
1619
self . assert_iscleanup ( body, block_data, target, is_cleanup) ;
1625
1620
}
1626
- if let Some ( cleanup) = cleanup {
1627
- if is_cleanup {
1628
- span_mirbug ! ( self , block_data, "cleanup on cleanup block" )
1629
- }
1630
- self . assert_iscleanup ( body, block_data, cleanup, true ) ;
1631
- }
1621
+ self . assert_iscleanup_unwind ( body, block_data, unwind, is_cleanup) ;
1632
1622
}
1633
1623
TerminatorKind :: FalseEdge { real_target, imaginary_target } => {
1634
1624
self . assert_iscleanup ( body, block_data, real_target, is_cleanup) ;
1635
1625
self . assert_iscleanup ( body, block_data, imaginary_target, is_cleanup) ;
1636
1626
}
1637
1627
TerminatorKind :: FalseUnwind { real_target, unwind } => {
1638
1628
self . assert_iscleanup ( body, block_data, real_target, is_cleanup) ;
1639
- if let Some ( unwind) = unwind {
1640
- if is_cleanup {
1641
- span_mirbug ! ( self , block_data, "cleanup in cleanup block via false unwind" ) ;
1642
- }
1643
- self . assert_iscleanup ( body, block_data, unwind, true ) ;
1644
- }
1629
+ self . assert_iscleanup_unwind ( body, block_data, unwind, is_cleanup) ;
1645
1630
}
1646
- TerminatorKind :: InlineAsm { destination, cleanup , .. } => {
1631
+ TerminatorKind :: InlineAsm { destination, unwind , .. } => {
1647
1632
if let Some ( target) = destination {
1648
1633
self . assert_iscleanup ( body, block_data, target, is_cleanup) ;
1649
1634
}
1650
- if let Some ( cleanup) = cleanup {
1651
- if is_cleanup {
1652
- span_mirbug ! ( self , block_data, "cleanup on cleanup block" )
1653
- }
1654
- self . assert_iscleanup ( body, block_data, cleanup, true ) ;
1655
- }
1635
+ self . assert_iscleanup_unwind ( body, block_data, unwind, is_cleanup) ;
1656
1636
}
1657
1637
}
1658
1638
}
@@ -1669,6 +1649,29 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1669
1649
}
1670
1650
}
1671
1651
1652
+ fn assert_iscleanup_unwind (
1653
+ & mut self ,
1654
+ body : & Body < ' tcx > ,
1655
+ ctxt : & dyn fmt:: Debug ,
1656
+ unwind : UnwindAction ,
1657
+ is_cleanup : bool ,
1658
+ ) {
1659
+ match unwind {
1660
+ UnwindAction :: Cleanup ( unwind) => {
1661
+ if is_cleanup {
1662
+ span_mirbug ! ( self , ctxt, "unwind on cleanup block" )
1663
+ }
1664
+ self . assert_iscleanup ( body, ctxt, unwind, true ) ;
1665
+ }
1666
+ UnwindAction :: Continue => {
1667
+ if is_cleanup {
1668
+ span_mirbug ! ( self , ctxt, "unwind on cleanup block" )
1669
+ }
1670
+ }
1671
+ UnwindAction :: Unreachable | UnwindAction :: Terminate => ( ) ,
1672
+ }
1673
+ }
1674
+
1672
1675
fn check_local ( & mut self , body : & Body < ' tcx > , local : Local , local_decl : & LocalDecl < ' tcx > ) {
1673
1676
match body. local_kind ( local) {
1674
1677
LocalKind :: ReturnPointer | LocalKind :: Arg => {
0 commit comments