File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,14 @@ fn main() {
4848        cmd. arg ( "-Z" ) . arg ( "force-unstable-if-unmarked" ) ; 
4949    } 
5050
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+ 
5159    std:: process:: exit ( match  cmd. status ( )  { 
5260        Ok ( s)  => s. code ( ) . unwrap_or ( 1 ) , 
5361        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> {
418418            . env ( "RUSTC_SYSROOT" ,  self . sysroot ( compiler) ) 
419419            . env ( "RUSTC_LIBDIR" ,  self . sysroot_libdir ( compiler,  self . build . build ) ) 
420420            . 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 ( ) ) ; 
422423        cmd
423424    } 
424425
@@ -574,6 +575,9 @@ impl<'a> Builder<'a> {
574575            cargo. env ( "RUSTC_SAVE_ANALYSIS" ,  "api" . to_string ( ) ) ; 
575576        } 
576577
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+ 
577581        // Environment variables *required* throughout the build 
578582        // 
579583        // FIXME: should update code to not require this env var 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments