@@ -2735,9 +2735,9 @@ impl PpMode {
2735
2735
crate mod dep_tracking {
2736
2736
use super :: {
2737
2737
BranchProtection , CFGuard , CFProtection , CrateType , DebugInfo , ErrorOutputType ,
2738
- InstrumentCoverage , LdImpl , LinkerPluginLto , LocationDetail , LtoCli , OptLevel , OutputType ,
2739
- OutputTypes , Passes , SourceFileHashAlgorithm , SwitchWithOptPath , SymbolManglingVersion ,
2740
- TrimmedDefPaths ,
2738
+ InstrumentCoverage , LdImpl , LinkerPluginLto , LocationDetail , LtoCli , OomStrategy , OptLevel ,
2739
+ OutputType , OutputTypes , Passes , SourceFileHashAlgorithm , SwitchWithOptPath ,
2740
+ SymbolManglingVersion , TrimmedDefPaths ,
2741
2741
} ;
2742
2742
use crate :: lint;
2743
2743
use crate :: options:: WasiExecModel ;
@@ -2833,6 +2833,7 @@ crate mod dep_tracking {
2833
2833
RealFileName ,
2834
2834
LocationDetail ,
2835
2835
BranchProtection ,
2836
+ OomStrategy ,
2836
2837
) ;
2837
2838
2838
2839
impl < T1 , T2 > DepTrackingHash for ( T1 , T2 )
@@ -2922,3 +2923,24 @@ crate mod dep_tracking {
2922
2923
}
2923
2924
}
2924
2925
}
2926
+
2927
+ /// Default behavior to use in out-of-memory situations.
2928
+ #[ derive( Clone , Copy , PartialEq , Hash , Debug , Encodable , Decodable , HashStable_Generic ) ]
2929
+ pub enum OomStrategy {
2930
+ /// Generate a panic that can be caught by `catch_unwind`.
2931
+ Panic ,
2932
+
2933
+ /// Abort the process immediately.
2934
+ Abort ,
2935
+ }
2936
+
2937
+ impl OomStrategy {
2938
+ pub const SYMBOL : & ' static str = "__rust_alloc_error_handler_should_panic" ;
2939
+
2940
+ pub fn should_panic ( self ) -> u8 {
2941
+ match self {
2942
+ OomStrategy :: Panic => 1 ,
2943
+ OomStrategy :: Abort => 0 ,
2944
+ }
2945
+ }
2946
+ }
0 commit comments