@@ -408,6 +408,7 @@ mod dist {
408408 use pretty_assertions:: assert_eq;
409409
410410 use super :: { Config , TEST_TRIPLE_1 , TEST_TRIPLE_2 , TEST_TRIPLE_3 , first, run_build} ;
411+ use crate :: Flags ;
411412 use crate :: core:: builder:: * ;
412413
413414 fn configure ( host : & [ & str ] , target : & [ & str ] ) -> Config {
@@ -646,6 +647,37 @@ mod dist {
646647 ) ;
647648 }
648649
650+ /// This also serves as an important regression test for <https://github.com/rust-lang/rust/issues/138123>
651+ /// and <https://github.com/rust-lang/rust/issues/138004>.
652+ #[ test]
653+ fn dist_all_cross ( ) {
654+ let cmd_args =
655+ & [ "dist" , "--stage" , "2" , "--dry-run" , "--config=/does/not/exist" ] . map ( str:: to_owned) ;
656+ let config_str = r#"
657+ [rust]
658+ channel = "nightly"
659+
660+ [build]
661+ extended = true
662+
663+ build = "i686-unknown-haiku"
664+ host = ["i686-unknown-netbsd"]
665+ target = ["i686-unknown-netbsd"]
666+ "# ;
667+ let config = Config :: parse_inner ( Flags :: parse ( cmd_args) , |& _| toml:: from_str ( config_str) ) ;
668+ let mut cache = run_build ( & [ ] , config) ;
669+
670+ // Stage 2 `compile::Rustc` should **NEVER** be cached here.
671+ assert_eq ! (
672+ first( cache. all:: <compile:: Rustc >( ) ) ,
673+ & [
674+ rustc!( TEST_TRIPLE_1 => TEST_TRIPLE_1 , stage = 0 ) ,
675+ rustc!( TEST_TRIPLE_1 => TEST_TRIPLE_1 , stage = 1 ) ,
676+ rustc!( TEST_TRIPLE_1 => TEST_TRIPLE_3 , stage = 1 ) ,
677+ ]
678+ ) ;
679+ }
680+
649681 #[ test]
650682 fn build_all ( ) {
651683 let build = Build :: new ( configure (
0 commit comments