@@ -1127,17 +1127,18 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
1127
1127
}
1128
1128
OptLevel :: Default
1129
1129
} else {
1130
- match cg. opt_level . as_ref ( ) . map ( String :: as_ref) {
1131
- None => OptLevel :: No ,
1132
- Some ( "0" ) => OptLevel :: No ,
1133
- Some ( "1" ) => OptLevel :: Less ,
1134
- Some ( "2" ) => OptLevel :: Default ,
1135
- Some ( "3" ) => OptLevel :: Aggressive ,
1136
- Some ( "s" ) => OptLevel :: Size ,
1137
- Some ( "z" ) => OptLevel :: SizeMin ,
1138
- Some ( arg) => {
1130
+ match ( cg. opt_level . as_ref ( ) . map ( String :: as_ref) ,
1131
+ nightly_options:: is_nightly_build ( ) ) {
1132
+ ( None , _) => OptLevel :: No ,
1133
+ ( Some ( "0" ) , _) => OptLevel :: No ,
1134
+ ( Some ( "1" ) , _) => OptLevel :: Less ,
1135
+ ( Some ( "2" ) , _) => OptLevel :: Default ,
1136
+ ( Some ( "3" ) , _) => OptLevel :: Aggressive ,
1137
+ ( Some ( "s" ) , true ) => OptLevel :: Size ,
1138
+ ( Some ( "z" ) , true ) => OptLevel :: SizeMin ,
1139
+ ( Some ( arg) , _) => {
1139
1140
early_error ( error_format, & format ! ( "optimization level needs to be \
1140
- between 0-3, s, or z (instead was `{}`)",
1141
+ between 0-3 (instead was `{}`)",
1141
1142
arg) ) ;
1142
1143
}
1143
1144
}
@@ -1308,7 +1309,7 @@ pub mod nightly_options {
1308
1309
is_nightly_build ( ) && matches. opt_strs ( "Z" ) . iter ( ) . any ( |x| * x == "unstable-options" )
1309
1310
}
1310
1311
1311
- fn is_nightly_build ( ) -> bool {
1312
+ pub fn is_nightly_build ( ) -> bool {
1312
1313
match get_unstable_features_setting ( ) {
1313
1314
UnstableFeatures :: Allow | UnstableFeatures :: Cheat => true ,
1314
1315
_ => false ,
0 commit comments