@@ -45,6 +45,26 @@ mod settings {
4545 pub const BLESS : & str = "RUSTFIX_TEST_BLESS" ;
4646}
4747
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+
4868fn compile ( file : & Path ) -> Result < Output , Error > {
4969 let tmp = tempdir ( ) ?;
5070
@@ -220,7 +240,20 @@ fn assert_fixtures(dir: &str, mode: &str) {
220240 . unwrap ( ) ;
221241 let mut failures = 0 ;
222242
243+ let is_not_nightly = !version ( ) . 1 ;
244+
223245 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+ }
224257 if let Err ( err) = test_rustfix_with_file ( file, mode) {
225258 println ! ( "failed: {}" , file. display( ) ) ;
226259 warn ! ( "{:?}" , err) ;
0 commit comments