@@ -637,6 +637,10 @@ pub enum TerminatorKind<'tcx> {
637
637
/// continue. Emitted by build::scope::diverge_cleanup.
638
638
Resume ,
639
639
640
+ /// Indicates that the landing pad is finished and that the process
641
+ /// should abort. Used to prevent unwinding for foreign items.
642
+ Abort ,
643
+
640
644
/// Indicates a normal return. The return place should have
641
645
/// been filled in by now. This should occur at most once.
642
646
Return ,
@@ -759,7 +763,7 @@ impl<'tcx> TerminatorKind<'tcx> {
759
763
match * self {
760
764
Goto { target : ref b } => slice:: from_ref ( b) . into_cow ( ) ,
761
765
SwitchInt { targets : ref b, .. } => b[ ..] . into_cow ( ) ,
762
- Resume | GeneratorDrop => ( & [ ] ) . into_cow ( ) ,
766
+ Resume | Abort | GeneratorDrop => ( & [ ] ) . into_cow ( ) ,
763
767
Return => ( & [ ] ) . into_cow ( ) ,
764
768
Unreachable => ( & [ ] ) . into_cow ( ) ,
765
769
Call { destination : Some ( ( _, t) ) , cleanup : Some ( c) , .. } => vec ! [ t, c] . into_cow ( ) ,
@@ -794,7 +798,7 @@ impl<'tcx> TerminatorKind<'tcx> {
794
798
match * self {
795
799
Goto { target : ref mut b } => vec ! [ b] ,
796
800
SwitchInt { targets : ref mut b, .. } => b. iter_mut ( ) . collect ( ) ,
797
- Resume | GeneratorDrop => Vec :: new ( ) ,
801
+ Resume | Abort | GeneratorDrop => Vec :: new ( ) ,
798
802
Return => Vec :: new ( ) ,
799
803
Unreachable => Vec :: new ( ) ,
800
804
Call { destination : Some ( ( _, ref mut t) ) , cleanup : Some ( ref mut c) , .. } => vec ! [ t, c] ,
@@ -823,6 +827,7 @@ impl<'tcx> TerminatorKind<'tcx> {
823
827
match * self {
824
828
TerminatorKind :: Goto { .. } |
825
829
TerminatorKind :: Resume |
830
+ TerminatorKind :: Abort |
826
831
TerminatorKind :: Return |
827
832
TerminatorKind :: Unreachable |
828
833
TerminatorKind :: GeneratorDrop |
@@ -918,6 +923,7 @@ impl<'tcx> TerminatorKind<'tcx> {
918
923
Return => write ! ( fmt, "return" ) ,
919
924
GeneratorDrop => write ! ( fmt, "generator_drop" ) ,
920
925
Resume => write ! ( fmt, "resume" ) ,
926
+ Abort => write ! ( fmt, "abort" ) ,
921
927
Yield { ref value, .. } => write ! ( fmt, "_1 = suspend({:?})" , value) ,
922
928
Unreachable => write ! ( fmt, "unreachable" ) ,
923
929
Drop { ref location, .. } => write ! ( fmt, "drop({:?})" , location) ,
@@ -970,7 +976,7 @@ impl<'tcx> TerminatorKind<'tcx> {
970
976
pub fn fmt_successor_labels ( & self ) -> Vec < Cow < ' static , str > > {
971
977
use self :: TerminatorKind :: * ;
972
978
match * self {
973
- Return | Resume | Unreachable | GeneratorDrop => vec ! [ ] ,
979
+ Return | Resume | Abort | Unreachable | GeneratorDrop => vec ! [ ] ,
974
980
Goto { .. } => vec ! [ "" . into( ) ] ,
975
981
SwitchInt { ref values, .. } => {
976
982
values. iter ( )
@@ -2102,6 +2108,7 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
2102
2108
} ,
2103
2109
GeneratorDrop => GeneratorDrop ,
2104
2110
Resume => Resume ,
2111
+ Abort => Abort ,
2105
2112
Return => Return ,
2106
2113
Unreachable => Unreachable ,
2107
2114
FalseEdges { real_target, ref imaginary_targets } =>
@@ -2143,6 +2150,7 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
2143
2150
} ,
2144
2151
Goto { .. } |
2145
2152
Resume |
2153
+ Abort |
2146
2154
Return |
2147
2155
GeneratorDrop |
2148
2156
Unreachable |
0 commit comments