@@ -579,17 +579,22 @@ impl Step for SharedAssets {
579
579
}
580
580
}
581
581
582
+ /// Document the standard library using `build_compiler`.
582
583
#[ derive( Debug , Clone , Hash , PartialEq , Eq , PartialOrd , Ord ) ]
583
584
pub struct Std {
584
- pub stage : u32 ,
585
- pub target : TargetSelection ,
586
- pub format : DocumentationFormat ,
585
+ build_compiler : Compiler ,
586
+ target : TargetSelection ,
587
+ format : DocumentationFormat ,
587
588
crates : Vec < String > ,
588
589
}
589
590
590
591
impl Std {
591
- pub ( crate ) fn new ( stage : u32 , target : TargetSelection , format : DocumentationFormat ) -> Self {
592
- Std { stage, target, format, crates : vec ! [ ] }
592
+ pub ( crate ) fn from_build_compiler (
593
+ build_compiler : Compiler ,
594
+ target : TargetSelection ,
595
+ format : DocumentationFormat ,
596
+ ) -> Self {
597
+ Std { build_compiler, target, format, crates : vec ! [ ] }
593
598
}
594
599
}
595
600
@@ -609,7 +614,7 @@ impl Step for Std {
609
614
return ;
610
615
}
611
616
run. builder . ensure ( Std {
612
- stage : run. builder . top_stage ,
617
+ build_compiler : run. builder . compiler ( run . builder . top_stage , run . builder . host_target ) ,
613
618
target : run. target ,
614
619
format : if run. builder . config . cmd . json ( ) {
615
620
DocumentationFormat :: Json
@@ -625,7 +630,6 @@ impl Step for Std {
625
630
/// This will generate all documentation for the standard library and its
626
631
/// dependencies. This is largely just a wrapper around `cargo doc`.
627
632
fn run ( self , builder : & Builder < ' _ > ) {
628
- let stage = self . stage ;
629
633
let target = self . target ;
630
634
let crates = if self . crates . is_empty ( ) {
631
635
builder
@@ -667,7 +671,7 @@ impl Step for Std {
667
671
// For `--index-page` and `--output-format=json`.
668
672
extra_args. push ( "-Zunstable-options" ) ;
669
673
670
- doc_std ( builder, self . format , stage , target, & out, & extra_args, & crates) ;
674
+ doc_std ( builder, self . format , self . build_compiler , target, & out, & extra_args, & crates) ;
671
675
672
676
// Don't open if the format is json
673
677
if let DocumentationFormat :: Json = self . format {
@@ -692,7 +696,7 @@ impl Step for Std {
692
696
fn metadata ( & self ) -> Option < StepMetadata > {
693
697
Some (
694
698
StepMetadata :: doc ( "std" , self . target )
695
- . stage ( self . stage )
699
+ . built_by ( self . build_compiler )
696
700
. with_metadata ( format ! ( "crates=[{}]" , self . crates. join( "," ) ) ) ,
697
701
)
698
702
}
@@ -728,24 +732,29 @@ impl DocumentationFormat {
728
732
fn doc_std (
729
733
builder : & Builder < ' _ > ,
730
734
format : DocumentationFormat ,
731
- stage : u32 ,
735
+ build_compiler : Compiler ,
732
736
target : TargetSelection ,
733
737
out : & Path ,
734
738
extra_args : & [ & str ] ,
735
739
requested_crates : & [ String ] ,
736
740
) {
737
- let compiler = builder. compiler ( stage, builder. config . host_target ) ;
738
-
739
741
let target_doc_dir_name = if format == DocumentationFormat :: Json { "json-doc" } else { "doc" } ;
740
- let target_dir = builder. stage_out ( compiler, Mode :: Std ) . join ( target) . join ( target_doc_dir_name) ;
742
+ let target_dir =
743
+ builder. stage_out ( build_compiler, Mode :: Std ) . join ( target) . join ( target_doc_dir_name) ;
741
744
742
745
// This is directory where the compiler will place the output of the command.
743
746
// We will then copy the files from this directory into the final `out` directory, the specified
744
747
// as a function parameter.
745
748
let out_dir = target_dir. join ( target) . join ( "doc" ) ;
746
749
747
- let mut cargo =
748
- builder:: Cargo :: new ( builder, compiler, Mode :: Std , SourceType :: InTree , target, Kind :: Doc ) ;
750
+ let mut cargo = builder:: Cargo :: new (
751
+ builder,
752
+ build_compiler,
753
+ Mode :: Std ,
754
+ SourceType :: InTree ,
755
+ target,
756
+ Kind :: Doc ,
757
+ ) ;
749
758
750
759
compile:: std_cargo ( builder, target, & mut cargo) ;
751
760
cargo
@@ -773,7 +782,7 @@ fn doc_std(
773
782
774
783
let description =
775
784
format ! ( "library{} in {} format" , crate_description( requested_crates) , format. as_str( ) ) ;
776
- let _guard = builder. msg_doc ( compiler , description, target) ;
785
+ let _guard = builder. msg_doc ( build_compiler , description, target) ;
777
786
778
787
cargo. into_cmd ( ) . run ( builder) ;
779
788
builder. cp_link_r ( & out_dir, out) ;
0 commit comments