@@ -630,6 +630,46 @@ fn any_debug() {
630630 assert_eq ! ( x. downcast_ref:: <MyStruct >( ) , Some ( & MyStruct { x: 7 } ) ) ;
631631}
632632
633+ #[ test]
634+ fn test_check_compiler_doesnt_build_llvm ( ) {
635+ // Checking the stage 1 compiler uses the bootstrap compiler, and therefore
636+ // should not need to build LLVM.
637+ {
638+ let config = configure_with_args (
639+ & [ "check" , "compiler" , "--stage=1" ] ,
640+ & [ TEST_TRIPLE_1 ] ,
641+ & [ TEST_TRIPLE_1 ] ,
642+ ) ;
643+ let mut cache = run_build ( & config. paths . clone ( ) , config) ;
644+
645+ assert ! ( !cache. contains:: <llvm:: Llvm >( ) ) ;
646+ }
647+
648+ // Checking the stage 1 library uses the stage 1 compiler, so it will need LLVM.
649+ {
650+ let config = configure_with_args (
651+ & [ "check" , "library" , "--stage=1" ] ,
652+ & [ TEST_TRIPLE_1 ] ,
653+ & [ TEST_TRIPLE_1 ] ,
654+ ) ;
655+ let mut cache = run_build ( & config. paths . clone ( ) , config) ;
656+
657+ assert ! ( cache. contains:: <llvm:: Llvm >( ) ) ;
658+ }
659+
660+ // Checking the stage 2 compiler uses the stage 1 compiler, so it will need LLVM.
661+ {
662+ let config = configure_with_args (
663+ & [ "check" , "compiler" , "--stage=2" ] ,
664+ & [ TEST_TRIPLE_1 ] ,
665+ & [ TEST_TRIPLE_1 ] ,
666+ ) ;
667+ let mut cache = run_build ( & config. paths . clone ( ) , config) ;
668+
669+ assert ! ( cache. contains:: <llvm:: Llvm >( ) ) ;
670+ }
671+ }
672+
633673/// These tests use insta for snapshot testing.
634674/// See bootstrap's README on how to bless the snapshots.
635675mod snapshot {
@@ -1294,7 +1334,6 @@ mod snapshot {
12941334 ctx. config( "check" )
12951335 . path( "compiler" )
12961336 . render_steps( ) , @r"
1297- [build] llvm <host>
12981337 [check] rustc 0 <host> -> rustc 1 <host>
12991338 [check] rustc 0 <host> -> cranelift 1 <host>
13001339 [check] rustc 0 <host> -> gcc 1 <host>
@@ -1304,7 +1343,6 @@ mod snapshot {
13041343 ctx. config( "check" )
13051344 . path( "rustc" )
13061345 . render_steps( ) , @r"
1307- [build] llvm <host>
13081346 [check] rustc 0 <host> -> rustc 1 <host>
13091347 " ) ;
13101348 }
@@ -1324,7 +1362,6 @@ mod snapshot {
13241362 . path( "compiler" )
13251363 . stage( 1 )
13261364 . render_steps( ) , @r"
1327- [build] llvm <host>
13281365 [check] rustc 0 <host> -> rustc 1 <host>
13291366 [check] rustc 0 <host> -> cranelift 1 <host>
13301367 [check] rustc 0 <host> -> gcc 1 <host>
@@ -1456,7 +1493,6 @@ mod snapshot {
14561493 . paths( & [ "library" , "compiler" ] )
14571494 . args( & args)
14581495 . render_steps( ) , @r"
1459- [build] llvm <host>
14601496 [check] rustc 0 <host> -> rustc 1 <host>
14611497 [check] rustc 0 <host> -> cranelift 1 <host>
14621498 [check] rustc 0 <host> -> gcc 1 <host>
@@ -1470,7 +1506,6 @@ mod snapshot {
14701506 ctx. config( "check" )
14711507 . path( "miri" )
14721508 . render_steps( ) , @r"
1473- [build] llvm <host>
14741509 [check] rustc 0 <host> -> rustc 1 <host>
14751510 [check] rustc 0 <host> -> Miri 1 <host>
14761511 " ) ;
@@ -1491,7 +1526,6 @@ mod snapshot {
14911526 . path( "miri" )
14921527 . stage( 1 )
14931528 . render_steps( ) , @r"
1494- [build] llvm <host>
14951529 [check] rustc 0 <host> -> rustc 1 <host>
14961530 [check] rustc 0 <host> -> Miri 1 <host>
14971531 " ) ;
@@ -1544,7 +1578,6 @@ mod snapshot {
15441578 ctx. config( "check" )
15451579 . path( "rustc_codegen_cranelift" )
15461580 . render_steps( ) , @r"
1547- [build] llvm <host>
15481581 [check] rustc 0 <host> -> rustc 1 <host>
15491582 [check] rustc 0 <host> -> cranelift 1 <host>
15501583 [check] rustc 0 <host> -> gcc 1 <host>
@@ -1558,7 +1591,6 @@ mod snapshot {
15581591 ctx. config( "check" )
15591592 . path( "rust-analyzer" )
15601593 . render_steps( ) , @r"
1561- [build] llvm <host>
15621594 [check] rustc 0 <host> -> rustc 1 <host>
15631595 [check] rustc 0 <host> -> rust-analyzer 1 <host>
15641596 " ) ;
0 commit comments