@@ -19,6 +19,7 @@ pub use self::DebugInfoLevel::*;
19
19
use session:: { early_error, early_warn, Session } ;
20
20
use session:: search_paths:: SearchPaths ;
21
21
22
+ use rustc_back:: PanicStrategy ;
22
23
use rustc_back:: target:: Target ;
23
24
use lint;
24
25
use middle:: cstore;
@@ -493,21 +494,6 @@ impl Passes {
493
494
}
494
495
}
495
496
496
- #[ derive( Clone , PartialEq , Hash , RustcEncodable , RustcDecodable ) ]
497
- pub enum PanicStrategy {
498
- Unwind ,
499
- Abort ,
500
- }
501
-
502
- impl PanicStrategy {
503
- pub fn desc ( & self ) -> & str {
504
- match * self {
505
- PanicStrategy :: Unwind => "unwind" ,
506
- PanicStrategy :: Abort => "abort" ,
507
- }
508
- }
509
- }
510
-
511
497
/// Declare a macro that will define all CodegenOptions/DebuggingOptions fields and parsers all
512
498
/// at once. The goal of this macro is to define an interface that can be
513
499
/// programmatically used by the option parser in order to initialize the struct
@@ -620,7 +606,8 @@ macro_rules! options {
620
606
621
607
#[ allow( dead_code) ]
622
608
mod $mod_set {
623
- use super :: { $struct_name, Passes , SomePasses , AllPasses , PanicStrategy } ;
609
+ use super :: { $struct_name, Passes , SomePasses , AllPasses } ;
610
+ use rustc_back:: PanicStrategy ;
624
611
625
612
$(
626
613
pub fn $opt( cg: & mut $struct_name, v: Option <& str >) -> bool {
@@ -725,10 +712,10 @@ macro_rules! options {
725
712
}
726
713
}
727
714
728
- fn parse_panic_strategy( slot: & mut PanicStrategy , v: Option <& str >) -> bool {
715
+ fn parse_panic_strategy( slot: & mut Option < PanicStrategy > , v: Option <& str >) -> bool {
729
716
match v {
730
- Some ( "unwind" ) => * slot = PanicStrategy :: Unwind ,
731
- Some ( "abort" ) => * slot = PanicStrategy :: Abort ,
717
+ Some ( "unwind" ) => * slot = Some ( PanicStrategy :: Unwind ) ,
718
+ Some ( "abort" ) => * slot = Some ( PanicStrategy :: Abort ) ,
732
719
_ => return false
733
720
}
734
721
true
@@ -800,7 +787,7 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
800
787
"explicitly enable the cfg(debug_assertions) directive" ) ,
801
788
inline_threshold: Option <usize > = ( None , parse_opt_uint, [ TRACKED ] ,
802
789
"set the inlining threshold for" ) ,
803
- panic: PanicStrategy = ( PanicStrategy :: Unwind , parse_panic_strategy,
790
+ panic: Option < PanicStrategy > = ( None , parse_panic_strategy,
804
791
[ TRACKED ] , "panic strategy to compile crate with" ) ,
805
792
}
806
793
@@ -1676,9 +1663,10 @@ mod dep_tracking {
1676
1663
use std:: collections:: BTreeMap ;
1677
1664
use std:: hash:: { Hash , SipHasher } ;
1678
1665
use std:: path:: PathBuf ;
1679
- use super :: { Passes , PanicStrategy , CrateType , OptLevel , DebugInfoLevel ,
1666
+ use super :: { Passes , CrateType , OptLevel , DebugInfoLevel ,
1680
1667
OutputTypes , Externs , ErrorOutputType } ;
1681
1668
use syntax:: feature_gate:: UnstableFeatures ;
1669
+ use rustc_back:: PanicStrategy ;
1682
1670
1683
1671
pub trait DepTrackingHash {
1684
1672
fn hash ( & self , & mut SipHasher , ErrorOutputType ) ;
@@ -1717,6 +1705,7 @@ mod dep_tracking {
1717
1705
impl_dep_tracking_hash_via_hash ! ( Option <bool >) ;
1718
1706
impl_dep_tracking_hash_via_hash ! ( Option <usize >) ;
1719
1707
impl_dep_tracking_hash_via_hash ! ( Option <String >) ;
1708
+ impl_dep_tracking_hash_via_hash ! ( Option <PanicStrategy >) ;
1720
1709
impl_dep_tracking_hash_via_hash ! ( Option <lint:: Level >) ;
1721
1710
impl_dep_tracking_hash_via_hash ! ( Option <PathBuf >) ;
1722
1711
impl_dep_tracking_hash_via_hash ! ( CrateType ) ;
@@ -1783,7 +1772,8 @@ mod tests {
1783
1772
use std:: iter:: FromIterator ;
1784
1773
use std:: path:: PathBuf ;
1785
1774
use std:: rc:: Rc ;
1786
- use super :: { OutputType , OutputTypes , Externs , PanicStrategy } ;
1775
+ use super :: { OutputType , OutputTypes , Externs } ;
1776
+ use rustc_back:: PanicStrategy ;
1787
1777
use syntax:: { ast, attr} ;
1788
1778
use syntax:: parse:: token:: InternedString ;
1789
1779
use syntax:: codemap:: dummy_spanned;
0 commit comments