@@ -225,10 +225,6 @@ fn ci_rustc_if_unchanged_logic() {
225225 |& _| Ok ( Default :: default ( ) ) ,
226226 ) ;
227227
228- if config. rust_info . is_from_tarball ( ) {
229- return ;
230- }
231-
232228 let build = Build :: new ( config. clone ( ) ) ;
233229 let builder = Builder :: new ( & build) ;
234230
@@ -238,26 +234,30 @@ fn ci_rustc_if_unchanged_logic() {
238234
239235 builder. run_step_descriptions ( & Builder :: get_step_descriptions ( config. cmd . kind ( ) ) , & [ ] ) ;
240236
241- let compiler_path = build. src . join ( "compiler" ) ;
242- let library_path = build. src . join ( "library" ) ;
243-
244- let commit =
245- get_closest_merge_commit ( Some ( & builder. config . src ) , & builder. config . git_config ( ) , & [
246- compiler_path. clone ( ) ,
247- library_path. clone ( ) ,
248- ] )
249- . unwrap ( ) ;
250-
251- let has_changes = !helpers:: git ( Some ( & builder. src ) )
252- . args ( [ "diff-index" , "--quiet" , & commit] )
253- . arg ( "--" )
254- . args ( [ compiler_path, library_path] )
255- . as_command_mut ( )
256- . status ( )
257- . unwrap ( )
258- . success ( ) ;
259-
260- assert ! ( has_changes == config. download_rustc_commit. is_none( ) ) ;
237+ // Make sure "if-unchanged" logic doesn't try to use CI rustc while there are changes
238+ // in compiler and/or library.
239+ if config. download_rustc_commit . is_some ( ) {
240+ let compiler_path = build. src . join ( "compiler" ) ;
241+ let library_path = build. src . join ( "library" ) ;
242+
243+ let commit =
244+ get_closest_merge_commit ( Some ( & builder. config . src ) , & builder. config . git_config ( ) , & [
245+ compiler_path. clone ( ) ,
246+ library_path. clone ( ) ,
247+ ] )
248+ . unwrap ( ) ;
249+
250+ let has_changes = !helpers:: git ( Some ( & builder. src ) )
251+ . args ( [ "diff-index" , "--quiet" , & commit] )
252+ . arg ( "--" )
253+ . args ( [ compiler_path, library_path] )
254+ . as_command_mut ( )
255+ . status ( )
256+ . unwrap ( )
257+ . success ( ) ;
258+
259+ assert ! ( !has_changes) ;
260+ }
261261}
262262
263263mod defaults {
0 commit comments