@@ -630,6 +630,46 @@ fn any_debug() {
630
630
assert_eq ! ( x. downcast_ref:: <MyStruct >( ) , Some ( & MyStruct { x: 7 } ) ) ;
631
631
}
632
632
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
+
633
673
/// These tests use insta for snapshot testing.
634
674
/// See bootstrap's README on how to bless the snapshots.
635
675
mod snapshot {
@@ -1294,7 +1334,6 @@ mod snapshot {
1294
1334
ctx. config( "check" )
1295
1335
. path( "compiler" )
1296
1336
. render_steps( ) , @r"
1297
- [build] llvm <host>
1298
1337
[check] rustc 0 <host> -> rustc 1 <host>
1299
1338
[check] rustc 0 <host> -> cranelift 1 <host>
1300
1339
[check] rustc 0 <host> -> gcc 1 <host>
@@ -1304,7 +1343,6 @@ mod snapshot {
1304
1343
ctx. config( "check" )
1305
1344
. path( "rustc" )
1306
1345
. render_steps( ) , @r"
1307
- [build] llvm <host>
1308
1346
[check] rustc 0 <host> -> rustc 1 <host>
1309
1347
" ) ;
1310
1348
}
@@ -1324,7 +1362,6 @@ mod snapshot {
1324
1362
. path( "compiler" )
1325
1363
. stage( 1 )
1326
1364
. render_steps( ) , @r"
1327
- [build] llvm <host>
1328
1365
[check] rustc 0 <host> -> rustc 1 <host>
1329
1366
[check] rustc 0 <host> -> cranelift 1 <host>
1330
1367
[check] rustc 0 <host> -> gcc 1 <host>
@@ -1456,7 +1493,6 @@ mod snapshot {
1456
1493
. paths( & [ "library" , "compiler" ] )
1457
1494
. args( & args)
1458
1495
. render_steps( ) , @r"
1459
- [build] llvm <host>
1460
1496
[check] rustc 0 <host> -> rustc 1 <host>
1461
1497
[check] rustc 0 <host> -> cranelift 1 <host>
1462
1498
[check] rustc 0 <host> -> gcc 1 <host>
@@ -1470,7 +1506,6 @@ mod snapshot {
1470
1506
ctx. config( "check" )
1471
1507
. path( "miri" )
1472
1508
. render_steps( ) , @r"
1473
- [build] llvm <host>
1474
1509
[check] rustc 0 <host> -> rustc 1 <host>
1475
1510
[check] rustc 0 <host> -> Miri 1 <host>
1476
1511
" ) ;
@@ -1491,7 +1526,6 @@ mod snapshot {
1491
1526
. path( "miri" )
1492
1527
. stage( 1 )
1493
1528
. render_steps( ) , @r"
1494
- [build] llvm <host>
1495
1529
[check] rustc 0 <host> -> rustc 1 <host>
1496
1530
[check] rustc 0 <host> -> Miri 1 <host>
1497
1531
" ) ;
@@ -1544,7 +1578,6 @@ mod snapshot {
1544
1578
ctx. config( "check" )
1545
1579
. path( "rustc_codegen_cranelift" )
1546
1580
. render_steps( ) , @r"
1547
- [build] llvm <host>
1548
1581
[check] rustc 0 <host> -> rustc 1 <host>
1549
1582
[check] rustc 0 <host> -> cranelift 1 <host>
1550
1583
[check] rustc 0 <host> -> gcc 1 <host>
@@ -1558,7 +1591,6 @@ mod snapshot {
1558
1591
ctx. config( "check" )
1559
1592
. path( "rust-analyzer" )
1560
1593
. render_steps( ) , @r"
1561
- [build] llvm <host>
1562
1594
[check] rustc 0 <host> -> rustc 1 <host>
1563
1595
[check] rustc 0 <host> -> rust-analyzer 1 <host>
1564
1596
" ) ;
0 commit comments