@@ -45,6 +45,26 @@ mod settings {
45
45
pub const BLESS : & str = "RUSTFIX_TEST_BLESS" ;
46
46
}
47
47
48
+ static mut VERSION : ( u32 , bool ) = ( 0 , false ) ;
49
+
50
+ // Temporarily copy from `cargo_test_macro::version`.
51
+ fn version ( ) -> ( u32 , bool ) {
52
+ static INIT : std:: sync:: Once = std:: sync:: Once :: new ( ) ;
53
+ INIT . call_once ( || {
54
+ let output = Command :: new ( "rustc" )
55
+ . arg ( "-V" )
56
+ . output ( )
57
+ . expect ( "cargo should run" ) ;
58
+ let stdout = std:: str:: from_utf8 ( & output. stdout ) . expect ( "utf8" ) ;
59
+ let vers = stdout. split_whitespace ( ) . skip ( 1 ) . next ( ) . unwrap ( ) ;
60
+ let is_nightly = option_env ! ( "CARGO_TEST_DISABLE_NIGHTLY" ) . is_none ( )
61
+ && ( vers. contains ( "-nightly" ) || vers. contains ( "-dev" ) ) ;
62
+ let minor = vers. split ( '.' ) . skip ( 1 ) . next ( ) . unwrap ( ) . parse ( ) . unwrap ( ) ;
63
+ unsafe { VERSION = ( minor, is_nightly) }
64
+ } ) ;
65
+ unsafe { VERSION }
66
+ }
67
+
48
68
fn compile ( file : & Path ) -> Result < Output , Error > {
49
69
let tmp = tempdir ( ) ?;
50
70
@@ -220,7 +240,20 @@ fn assert_fixtures(dir: &str, mode: &str) {
220
240
. unwrap ( ) ;
221
241
let mut failures = 0 ;
222
242
243
+ let is_not_nightly = !version ( ) . 1 ;
244
+
223
245
for file in & files {
246
+ if file
247
+ . file_stem ( )
248
+ . unwrap ( )
249
+ . to_str ( )
250
+ . unwrap ( )
251
+ . ends_with ( ".nightly" )
252
+ && is_not_nightly
253
+ {
254
+ info ! ( "skipped: {file:?}" ) ;
255
+ continue ;
256
+ }
224
257
if let Err ( err) = test_rustfix_with_file ( file, mode) {
225
258
println ! ( "failed: {}" , file. display( ) ) ;
226
259
warn ! ( "{:?}" , err) ;
0 commit comments