@@ -71,7 +71,7 @@ fn check_cli<const N: usize>(paths: [&str; N]) {
71
71
macro_rules! std {
72
72
( $host: ident => $target: ident, stage = $stage: literal) => {
73
73
compile:: Std :: new(
74
- Compiler { host : TargetSelection :: from_user( $host) , stage : $stage } ,
74
+ Compiler :: new ( $stage , TargetSelection :: from_user( $host) ) ,
75
75
TargetSelection :: from_user( $target) ,
76
76
)
77
77
} ;
@@ -84,7 +84,7 @@ macro_rules! doc_std {
84
84
macro_rules! rustc {
85
85
( $host: ident => $target: ident, stage = $stage: literal) => {
86
86
compile:: Rustc :: new(
87
- Compiler { host : TargetSelection :: from_user( $host) , stage : $stage } ,
87
+ Compiler :: new ( $stage , TargetSelection :: from_user( $host) ) ,
88
88
TargetSelection :: from_user( $target) ,
89
89
)
90
90
} ;
@@ -296,7 +296,7 @@ mod defaults {
296
296
first( cache. all:: <tool:: Rustdoc >( ) ) ,
297
297
// Recall that rustdoc stages are off-by-one
298
298
// - this is the compiler it's _linked_ to, not built with.
299
- & [ tool:: Rustdoc { compiler: Compiler { host : a , stage : 1 } } ] ,
299
+ & [ tool:: Rustdoc { compiler: Compiler :: new ( 1 , a ) } ] ,
300
300
) ;
301
301
assert_eq ! (
302
302
first( cache. all:: <compile:: Rustc >( ) ) ,
@@ -319,7 +319,7 @@ mod defaults {
319
319
first( cache. all:: <tool:: Rustdoc >( ) ) ,
320
320
// This is the beta rustdoc.
321
321
// Add an assert here to make sure this is the only rustdoc built.
322
- & [ tool:: Rustdoc { compiler: Compiler { host : a , stage : 0 } } ] ,
322
+ & [ tool:: Rustdoc { compiler: Compiler :: new ( 0 , a ) } ] ,
323
323
) ;
324
324
assert ! ( cache. all:: <compile:: Rustc >( ) . is_empty( ) ) ;
325
325
}
@@ -352,16 +352,16 @@ mod defaults {
352
352
assert_eq ! (
353
353
first( cache. all:: <compile:: Assemble >( ) ) ,
354
354
& [
355
- compile:: Assemble { target_compiler: Compiler { host : a , stage : 0 } } ,
356
- compile:: Assemble { target_compiler: Compiler { host : a , stage : 1 } } ,
357
- compile:: Assemble { target_compiler: Compiler { host : b , stage : 1 } } ,
355
+ compile:: Assemble { target_compiler: Compiler :: new ( 0 , a ) } ,
356
+ compile:: Assemble { target_compiler: Compiler :: new ( 1 , a ) } ,
357
+ compile:: Assemble { target_compiler: Compiler :: new ( 1 , b ) } ,
358
358
]
359
359
) ;
360
360
assert_eq ! (
361
361
first( cache. all:: <tool:: Rustdoc >( ) ) ,
362
362
& [
363
- tool:: Rustdoc { compiler: Compiler { host : a , stage : 1 } } ,
364
- tool:: Rustdoc { compiler: Compiler { host : b , stage : 1 } } ,
363
+ tool:: Rustdoc { compiler: Compiler :: new ( 1 , a ) } ,
364
+ tool:: Rustdoc { compiler: Compiler :: new ( 1 , b ) } ,
365
365
] ,
366
366
) ;
367
367
assert_eq ! (
@@ -386,14 +386,14 @@ mod defaults {
386
386
assert_eq ! ( first( cache. all:: <doc:: ErrorIndex >( ) ) , & [ doc:: ErrorIndex { target: a } , ] ) ;
387
387
assert_eq ! (
388
388
first( cache. all:: <tool:: ErrorIndex >( ) ) ,
389
- & [ tool:: ErrorIndex { compiler: Compiler { host : a , stage : 0 } } ]
389
+ & [ tool:: ErrorIndex { compiler: Compiler :: new ( 0 , a ) } ]
390
390
) ;
391
391
// docs should be built with the beta compiler, not with the stage0 artifacts.
392
392
// recall that rustdoc is off-by-one: `stage` is the compiler rustdoc is _linked_ to,
393
393
// not the one it was built by.
394
394
assert_eq ! (
395
395
first( cache. all:: <tool:: Rustdoc >( ) ) ,
396
- & [ tool:: Rustdoc { compiler: Compiler { host : a , stage : 0 } } , ]
396
+ & [ tool:: Rustdoc { compiler: Compiler :: new ( 0 , a ) } , ]
397
397
) ;
398
398
}
399
399
}
@@ -418,17 +418,17 @@ mod dist {
418
418
assert_eq ! ( first( cache. all:: <dist:: Mingw >( ) ) , & [ dist:: Mingw { host: a } , ] ) ;
419
419
assert_eq ! (
420
420
first( cache. all:: <dist:: Rustc >( ) ) ,
421
- & [ dist:: Rustc { compiler: Compiler { host : a , stage : 2 } } , ]
421
+ & [ dist:: Rustc { compiler: Compiler :: new ( 2 , a ) } , ]
422
422
) ;
423
423
assert_eq ! (
424
424
first( cache. all:: <dist:: Std >( ) ) ,
425
- & [ dist:: Std { compiler: Compiler { host : a , stage : 1 } , target: a } , ]
425
+ & [ dist:: Std { compiler: Compiler :: new ( 1 , a ) , target: a } , ]
426
426
) ;
427
427
assert_eq ! ( first( cache. all:: <dist:: Src >( ) ) , & [ dist:: Src ] ) ;
428
428
// Make sure rustdoc is only built once.
429
429
assert_eq ! (
430
430
first( cache. all:: <tool:: Rustdoc >( ) ) ,
431
- & [ tool:: Rustdoc { compiler: Compiler { host : a , stage : 2 } } , ]
431
+ & [ tool:: Rustdoc { compiler: Compiler :: new ( 2 , a ) } , ]
432
432
) ;
433
433
}
434
434
@@ -450,13 +450,13 @@ mod dist {
450
450
) ;
451
451
assert_eq ! (
452
452
first( cache. all:: <dist:: Rustc >( ) ) ,
453
- & [ dist:: Rustc { compiler: Compiler { host : a , stage : 2 } } , ]
453
+ & [ dist:: Rustc { compiler: Compiler :: new ( 2 , a ) } , ]
454
454
) ;
455
455
assert_eq ! (
456
456
first( cache. all:: <dist:: Std >( ) ) ,
457
457
& [
458
- dist:: Std { compiler: Compiler { host : a , stage : 1 } , target: a } ,
459
- dist:: Std { compiler: Compiler { host : a , stage : 2 } , target: b } ,
458
+ dist:: Std { compiler: Compiler :: new ( 1 , a ) , target: a } ,
459
+ dist:: Std { compiler: Compiler :: new ( 2 , a ) , target: b } ,
460
460
]
461
461
) ;
462
462
assert_eq ! ( first( cache. all:: <dist:: Src >( ) ) , & [ dist:: Src ] ) ;
@@ -483,15 +483,15 @@ mod dist {
483
483
assert_eq ! (
484
484
first( cache. all:: <dist:: Rustc >( ) ) ,
485
485
& [
486
- dist:: Rustc { compiler: Compiler { host : a , stage : 2 } } ,
487
- dist:: Rustc { compiler: Compiler { host : b , stage : 2 } } ,
486
+ dist:: Rustc { compiler: Compiler :: new ( 2 , a ) } ,
487
+ dist:: Rustc { compiler: Compiler :: new ( 2 , b ) } ,
488
488
]
489
489
) ;
490
490
assert_eq ! (
491
491
first( cache. all:: <dist:: Std >( ) ) ,
492
492
& [
493
- dist:: Std { compiler: Compiler { host : a , stage : 1 } , target: a } ,
494
- dist:: Std { compiler: Compiler { host : a , stage : 1 } , target: b } ,
493
+ dist:: Std { compiler: Compiler :: new ( 1 , a ) , target: a } ,
494
+ dist:: Std { compiler: Compiler :: new ( 1 , a ) , target: b } ,
495
495
]
496
496
) ;
497
497
assert_eq ! (
@@ -519,7 +519,7 @@ mod dist {
519
519
520
520
assert_eq ! (
521
521
first( cache. all:: <dist:: Rustc >( ) ) ,
522
- & [ dist:: Rustc { compiler: Compiler { host : b , stage : 2 } } , ]
522
+ & [ dist:: Rustc { compiler: Compiler :: new ( 2 , b ) } , ]
523
523
) ;
524
524
assert_eq ! (
525
525
first( cache. all:: <compile:: Rustc >( ) ) ,
@@ -556,16 +556,16 @@ mod dist {
556
556
assert_eq ! (
557
557
first( cache. all:: <dist:: Rustc >( ) ) ,
558
558
& [
559
- dist:: Rustc { compiler: Compiler { host : a , stage : 2 } } ,
560
- dist:: Rustc { compiler: Compiler { host : b , stage : 2 } } ,
559
+ dist:: Rustc { compiler: Compiler :: new ( 2 , a ) } ,
560
+ dist:: Rustc { compiler: Compiler :: new ( 2 , b ) } ,
561
561
]
562
562
) ;
563
563
assert_eq ! (
564
564
first( cache. all:: <dist:: Std >( ) ) ,
565
565
& [
566
- dist:: Std { compiler: Compiler { host : a , stage : 1 } , target: a } ,
567
- dist:: Std { compiler: Compiler { host : a , stage : 1 } , target: b } ,
568
- dist:: Std { compiler: Compiler { host : a , stage : 2 } , target: c } ,
566
+ dist:: Std { compiler: Compiler :: new ( 1 , a ) , target: a } ,
567
+ dist:: Std { compiler: Compiler :: new ( 1 , a ) , target: b } ,
568
+ dist:: Std { compiler: Compiler :: new ( 2 , a ) , target: c } ,
569
569
]
570
570
) ;
571
571
assert_eq ! ( first( cache. all:: <dist:: Src >( ) ) , & [ dist:: Src ] ) ;
@@ -583,7 +583,7 @@ mod dist {
583
583
assert_eq ! ( first( cache. all:: <dist:: Mingw >( ) ) , & [ dist:: Mingw { host: c } , ] ) ;
584
584
assert_eq ! (
585
585
first( cache. all:: <dist:: Std >( ) ) ,
586
- & [ dist:: Std { compiler: Compiler { host : a , stage : 2 } , target: c } , ]
586
+ & [ dist:: Std { compiler: Compiler :: new ( 2 , a ) , target: c } , ]
587
587
) ;
588
588
}
589
589
@@ -608,15 +608,15 @@ mod dist {
608
608
assert_eq ! (
609
609
first( cache. all:: <dist:: Rustc >( ) ) ,
610
610
& [
611
- dist:: Rustc { compiler: Compiler { host : a , stage : 2 } } ,
612
- dist:: Rustc { compiler: Compiler { host : b , stage : 2 } } ,
611
+ dist:: Rustc { compiler: Compiler :: new ( 2 , a ) } ,
612
+ dist:: Rustc { compiler: Compiler :: new ( 2 , b ) } ,
613
613
]
614
614
) ;
615
615
assert_eq ! (
616
616
first( cache. all:: <dist:: Std >( ) ) ,
617
617
& [
618
- dist:: Std { compiler: Compiler { host : a , stage : 1 } , target: a } ,
619
- dist:: Std { compiler: Compiler { host : a , stage : 1 } , target: b } ,
618
+ dist:: Std { compiler: Compiler :: new ( 1 , a ) , target: a } ,
619
+ dist:: Std { compiler: Compiler :: new ( 1 , a ) , target: b } ,
620
620
]
621
621
) ;
622
622
assert_eq ! ( first( cache. all:: <dist:: Src >( ) ) , & [ dist:: Src ] ) ;
@@ -633,10 +633,10 @@ mod dist {
633
633
assert_eq ! (
634
634
first( cache. all:: <compile:: Assemble >( ) ) ,
635
635
& [
636
- compile:: Assemble { target_compiler: Compiler { host : a , stage : 0 } } ,
637
- compile:: Assemble { target_compiler: Compiler { host : a , stage : 1 } } ,
638
- compile:: Assemble { target_compiler: Compiler { host : a , stage : 2 } } ,
639
- compile:: Assemble { target_compiler: Compiler { host : b , stage : 2 } } ,
636
+ compile:: Assemble { target_compiler: Compiler :: new ( 0 , a ) } ,
637
+ compile:: Assemble { target_compiler: Compiler :: new ( 1 , a ) } ,
638
+ compile:: Assemble { target_compiler: Compiler :: new ( 2 , a ) } ,
639
+ compile:: Assemble { target_compiler: Compiler :: new ( 2 , b ) } ,
640
640
]
641
641
) ;
642
642
}
@@ -683,28 +683,16 @@ mod dist {
683
683
first( builder. cache. all:: <compile:: Assemble >( ) ) ,
684
684
& [
685
685
compile:: Assemble {
686
- target_compiler: Compiler {
687
- host: TargetSelection :: from_user( TEST_TRIPLE_1 ) ,
688
- stage: 0
689
- }
686
+ target_compiler: Compiler :: new( 0 , TargetSelection :: from_user( TEST_TRIPLE_1 ) , )
690
687
} ,
691
688
compile:: Assemble {
692
- target_compiler: Compiler {
693
- host: TargetSelection :: from_user( TEST_TRIPLE_1 ) ,
694
- stage: 1
695
- }
689
+ target_compiler: Compiler :: new( 1 , TargetSelection :: from_user( TEST_TRIPLE_1 ) , )
696
690
} ,
697
691
compile:: Assemble {
698
- target_compiler: Compiler {
699
- host: TargetSelection :: from_user( TEST_TRIPLE_1 ) ,
700
- stage: 2
701
- }
692
+ target_compiler: Compiler :: new( 2 , TargetSelection :: from_user( TEST_TRIPLE_1 ) , )
702
693
} ,
703
694
compile:: Assemble {
704
- target_compiler: Compiler {
705
- host: TargetSelection :: from_user( TEST_TRIPLE_2 ) ,
706
- stage: 2
707
- }
695
+ target_compiler: Compiler :: new( 2 , TargetSelection :: from_user( TEST_TRIPLE_2 ) , )
708
696
} ,
709
697
]
710
698
) ;
@@ -747,9 +735,9 @@ mod dist {
747
735
assert_eq ! (
748
736
first( builder. cache. all:: <compile:: Assemble >( ) ) ,
749
737
& [
750
- compile:: Assemble { target_compiler: Compiler { host : a , stage : 0 } } ,
751
- compile:: Assemble { target_compiler: Compiler { host : a , stage : 1 } } ,
752
- compile:: Assemble { target_compiler: Compiler { host : a , stage : 2 } } ,
738
+ compile:: Assemble { target_compiler: Compiler :: new ( 0 , a ) } ,
739
+ compile:: Assemble { target_compiler: Compiler :: new ( 1 , a ) } ,
740
+ compile:: Assemble { target_compiler: Compiler :: new ( 2 , a ) } ,
753
741
]
754
742
) ;
755
743
assert_eq ! (
@@ -798,7 +786,7 @@ mod dist {
798
786
assert_eq ! (
799
787
first( builder. cache. all:: <test:: Crate >( ) ) ,
800
788
& [ test:: Crate {
801
- compiler: Compiler { host , stage : 0 } ,
789
+ compiler: Compiler :: new ( 0 , host ) ,
802
790
target: host,
803
791
mode: crate :: Mode :: Std ,
804
792
crates: vec![ "std" . to_owned( ) ] ,
@@ -824,13 +812,13 @@ mod dist {
824
812
) ;
825
813
assert_eq ! (
826
814
first( builder. cache. all:: <tool:: ErrorIndex >( ) ) ,
827
- & [ tool:: ErrorIndex { compiler: Compiler { host : a , stage : 1 } } ]
815
+ & [ tool:: ErrorIndex { compiler: Compiler :: new ( 1 , a ) } ]
828
816
) ;
829
817
// This is actually stage 1, but Rustdoc::run swaps out the compiler with
830
818
// stage minus 1 if --stage is not 0. Very confusing!
831
819
assert_eq ! (
832
820
first( builder. cache. all:: <tool:: Rustdoc >( ) ) ,
833
- & [ tool:: Rustdoc { compiler: Compiler { host : a , stage : 2 } } , ]
821
+ & [ tool:: Rustdoc { compiler: Compiler :: new ( 2 , a ) } , ]
834
822
) ;
835
823
}
836
824
@@ -870,7 +858,7 @@ mod dist {
870
858
) ;
871
859
assert_eq ! (
872
860
first( builder. cache. all:: <tool:: ErrorIndex >( ) ) ,
873
- & [ tool:: ErrorIndex { compiler: Compiler { host : a , stage : 1 } } ]
861
+ & [ tool:: ErrorIndex { compiler: Compiler :: new ( 1 , a ) } ]
874
862
) ;
875
863
// Unfortunately rustdoc is built twice. Once from stage1 for compiletest
876
864
// (and other things), and once from stage0 for std crates. Ideally it
@@ -886,9 +874,9 @@ mod dist {
886
874
assert_eq ! (
887
875
first( builder. cache. all:: <tool:: Rustdoc >( ) ) ,
888
876
& [
889
- tool:: Rustdoc { compiler: Compiler { host : a , stage : 0 } } ,
890
- tool:: Rustdoc { compiler: Compiler { host : a , stage : 1 } } ,
891
- tool:: Rustdoc { compiler: Compiler { host : a , stage : 2 } } ,
877
+ tool:: Rustdoc { compiler: Compiler :: new ( 0 , a ) } ,
878
+ tool:: Rustdoc { compiler: Compiler :: new ( 1 , a ) } ,
879
+ tool:: Rustdoc { compiler: Compiler :: new ( 2 , a ) } ,
892
880
]
893
881
) ;
894
882
}
@@ -904,7 +892,7 @@ mod sysroot_target_dirs {
904
892
let build = Build :: new ( configure ( "build" , & [ TEST_TRIPLE_1 ] , & [ TEST_TRIPLE_1 ] ) ) ;
905
893
let builder = Builder :: new ( & build) ;
906
894
let target_triple_1 = TargetSelection :: from_user ( TEST_TRIPLE_1 ) ;
907
- let compiler = Compiler { stage : 1 , host : target_triple_1 } ;
895
+ let compiler = Compiler :: new ( 1 , target_triple_1) ;
908
896
let target_triple_2 = TargetSelection :: from_user ( TEST_TRIPLE_2 ) ;
909
897
let actual = builder. sysroot_target_libdir ( compiler, target_triple_2) ;
910
898
@@ -924,7 +912,7 @@ mod sysroot_target_dirs {
924
912
let build = Build :: new ( configure ( "build" , & [ TEST_TRIPLE_1 ] , & [ TEST_TRIPLE_1 ] ) ) ;
925
913
let builder = Builder :: new ( & build) ;
926
914
let target_triple_1 = TargetSelection :: from_user ( TEST_TRIPLE_1 ) ;
927
- let compiler = Compiler { stage : 1 , host : target_triple_1 } ;
915
+ let compiler = Compiler :: new ( 1 , target_triple_1) ;
928
916
let target_triple_2 = TargetSelection :: from_user ( TEST_TRIPLE_2 ) ;
929
917
let actual = builder. sysroot_target_bindir ( compiler, target_triple_2) ;
930
918
@@ -1128,13 +1116,13 @@ fn test_get_tool_rustc_compiler() {
1128
1116
1129
1117
let target_triple_1 = TargetSelection :: from_user ( TEST_TRIPLE_1 ) ;
1130
1118
1131
- let compiler = Compiler { stage : 2 , host : target_triple_1 } ;
1132
- let expected = Compiler { stage : 1 , host : target_triple_1 } ;
1119
+ let compiler = Compiler :: new ( 2 , target_triple_1) ;
1120
+ let expected = Compiler :: new ( 1 , target_triple_1) ;
1133
1121
let actual = tool:: get_tool_rustc_compiler ( & builder, compiler) ;
1134
1122
assert_eq ! ( expected, actual) ;
1135
1123
1136
- let compiler = Compiler { stage : 1 , host : target_triple_1 } ;
1137
- let expected = Compiler { stage : 0 , host : target_triple_1 } ;
1124
+ let compiler = Compiler :: new ( 1 , target_triple_1) ;
1125
+ let expected = Compiler :: new ( 0 , target_triple_1) ;
1138
1126
let actual = tool:: get_tool_rustc_compiler ( & builder, compiler) ;
1139
1127
assert_eq ! ( expected, actual) ;
1140
1128
@@ -1143,8 +1131,8 @@ fn test_get_tool_rustc_compiler() {
1143
1131
let build = Build :: new ( config) ;
1144
1132
let builder = Builder :: new ( & build) ;
1145
1133
1146
- let compiler = Compiler { stage : 1 , host : target_triple_1 } ;
1147
- let expected = Compiler { stage : 1 , host : target_triple_1 } ;
1134
+ let compiler = Compiler :: new ( 1 , target_triple_1) ;
1135
+ let expected = Compiler :: new ( 1 , target_triple_1) ;
1148
1136
let actual = tool:: get_tool_rustc_compiler ( & builder, compiler) ;
1149
1137
assert_eq ! ( expected, actual) ;
1150
1138
}
0 commit comments