@@ -368,6 +368,9 @@ pub struct Config {
368368    /// The paths to work with. For example: with `./x check foo bar` we get 
369369     /// `paths=["foo", "bar"]`. 
370370     pub  paths :  Vec < PathBuf > , 
371+ 
372+     /// Command for visual diff display, e.g. `diff-tool --color=always`. 
373+      pub  compiletest_diff_tool :  Option < String > , 
371374} 
372375
373376#[ derive( Clone ,  Debug ,  Default ) ]  
@@ -892,6 +895,7 @@ define_config! {
892895        android_ndk:  Option <PathBuf > = "android-ndk" , 
893896        optimized_compiler_builtins:  Option <bool > = "optimized-compiler-builtins" , 
894897        jobs:  Option <u32 > = "jobs" , 
898+         compiletest_diff_tool:  Option <String > = "compiletest-diff-tool" , 
895899    } 
896900} 
897901
@@ -1512,6 +1516,7 @@ impl Config {
15121516            android_ndk, 
15131517            optimized_compiler_builtins, 
15141518            jobs, 
1519+             compiletest_diff_tool, 
15151520        }  = toml. build . unwrap_or_default ( ) ; 
15161521
15171522        config. jobs  = Some ( threads_from_config ( flags. jobs . unwrap_or ( jobs. unwrap_or ( 0 ) ) ) ) ; 
@@ -2158,6 +2163,7 @@ impl Config {
21582163        config. rust_debuginfo_level_tests  = debuginfo_level_tests. unwrap_or ( DebuginfoLevel :: None ) ; 
21592164        config. optimized_compiler_builtins  =
21602165            optimized_compiler_builtins. unwrap_or ( config. channel  != "dev" ) ; 
2166+         config. compiletest_diff_tool  = compiletest_diff_tool; 
21612167
21622168        let  download_rustc = config. download_rustc_commit . is_some ( ) ; 
21632169        // See https://github.com/rust-lang/compiler-team/issues/326 
@@ -2754,25 +2760,25 @@ impl Config {
27542760            } 
27552761        } ; 
27562762
2757-         let  files_to_track = & [ 
2758-             self . src . join ( "compiler" ) , 
2759-             self . src . join ( "library" ) , 
2760-             self . src . join ( "src/version" ) , 
2761-             self . src . join ( "src/stage0" ) , 
2762-             self . src . join ( "src/ci/channel" ) , 
2763-         ] ; 
2763+         let  files_to_track =
2764+             & [ "compiler" ,  "library" ,  "src/version" ,  "src/stage0" ,  "src/ci/channel" ] ; 
27642765
27652766        // Look for a version to compare to based on the current commit. 
27662767        // Only commits merged by bors will have CI artifacts. 
2767-         let  commit =
2768-             get_closest_merge_commit ( Some ( & self . src ) ,  & self . git_config ( ) ,  files_to_track) . unwrap ( ) ; 
2769-         if  commit. is_empty ( )  { 
2770-             println ! ( "ERROR: could not find commit hash for downloading rustc" ) ; 
2771-             println ! ( "HELP: maybe your repository history is too shallow?" ) ; 
2772-             println ! ( "HELP: consider disabling `download-rustc`" ) ; 
2773-             println ! ( "HELP: or fetch enough history to include one upstream commit" ) ; 
2774-             crate :: exit!( 1 ) ; 
2775-         } 
2768+         let  commit = match  self . last_modified_commit ( files_to_track,  "download-rustc" ,  if_unchanged) 
2769+         { 
2770+             Some ( commit)  => commit, 
2771+             None  => { 
2772+                 if  if_unchanged { 
2773+                     return  None ; 
2774+                 } 
2775+                 println ! ( "ERROR: could not find commit hash for downloading rustc" ) ; 
2776+                 println ! ( "HELP: maybe your repository history is too shallow?" ) ; 
2777+                 println ! ( "HELP: consider disabling `download-rustc`" ) ; 
2778+                 println ! ( "HELP: or fetch enough history to include one upstream commit" ) ; 
2779+                 crate :: exit!( 1 ) ; 
2780+             } 
2781+         } ; 
27762782
27772783        if  CiEnv :: is_ci ( )  && { 
27782784            let  head_sha =
@@ -2787,31 +2793,7 @@ impl Config {
27872793            return  None ; 
27882794        } 
27892795
2790-         // Warn if there were changes to the compiler or standard library since the ancestor commit. 
2791-         let  has_changes = !t ! ( helpers:: git( Some ( & self . src) ) 
2792-             . args( [ "diff-index" ,  "--quiet" ,  & commit] ) 
2793-             . arg( "--" ) 
2794-             . args( files_to_track) 
2795-             . as_command_mut( ) 
2796-             . status( ) ) 
2797-         . success ( ) ; 
2798-         if  has_changes { 
2799-             if  if_unchanged { 
2800-                 if  self . is_verbose ( )  { 
2801-                     println ! ( 
2802-                         "WARNING: saw changes to compiler/ or library/ since {commit}; \  
2803-                              ignoring `download-rustc`"
2804-                     ) ; 
2805-                 } 
2806-                 return  None ; 
2807-             } 
2808-             println ! ( 
2809-                 "WARNING: `download-rustc` is enabled, but there are changes to \  
2810-                      compiler/ or library/"
2811-             ) ; 
2812-         } 
2813- 
2814-         Some ( commit. to_string ( ) ) 
2796+         Some ( commit) 
28152797    } 
28162798
28172799    fn  parse_download_ci_llvm ( 
0 commit comments