File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,14 @@ fn main() {
48
48
cmd. arg ( "-Z" ) . arg ( "force-unstable-if-unmarked" ) ;
49
49
}
50
50
51
+ // Bootstrap's Cargo-command builder sets this variable to the current Rust version; let's pick
52
+ // it up so we can make rustdoc print this into the docs
53
+ if let Some ( version) = env:: var_os ( "RUSTDOC_CRATE_VERSION" ) {
54
+ // This "unstable-options" can be removed when `--crate-version` is stabilized
55
+ cmd. arg ( "-Z" ) . arg ( "unstable-options" )
56
+ . arg ( "--crate-version" ) . arg ( version) ;
57
+ }
58
+
51
59
std:: process:: exit ( match cmd. status ( ) {
52
60
Ok ( s) => s. code ( ) . unwrap_or ( 1 ) ,
53
61
Err ( e) => panic ! ( "\n \n failed to run {:?}: {}\n \n " , cmd, e) ,
Original file line number Diff line number Diff line change @@ -418,7 +418,8 @@ impl<'a> Builder<'a> {
418
418
. env ( "RUSTC_SYSROOT" , self . sysroot ( compiler) )
419
419
. env ( "RUSTC_LIBDIR" , self . sysroot_libdir ( compiler, self . build . build ) )
420
420
. env ( "CFG_RELEASE_CHANNEL" , & self . build . config . channel )
421
- . env ( "RUSTDOC_REAL" , self . rustdoc ( host) ) ;
421
+ . env ( "RUSTDOC_REAL" , self . rustdoc ( host) )
422
+ . env ( "RUSTDOC_CRATE_VERSION" , self . build . rust_version ( ) ) ;
422
423
cmd
423
424
}
424
425
@@ -574,6 +575,9 @@ impl<'a> Builder<'a> {
574
575
cargo. env ( "RUSTC_SAVE_ANALYSIS" , "api" . to_string ( ) ) ;
575
576
}
576
577
578
+ // For `cargo doc` invocations, make rustdoc print the Rust version into the docs
579
+ cargo. env ( "RUSTDOC_CRATE_VERSION" , self . build . rust_version ( ) ) ;
580
+
577
581
// Environment variables *required* throughout the build
578
582
//
579
583
// FIXME: should update code to not require this env var
You can’t perform that action at this time.
0 commit comments