This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ pub(crate) fn build_sysroot(
35
35
try_hard_link ( cg_clif_dylib_src, & cg_clif_dylib_path) ;
36
36
37
37
// Build and copy rustc and cargo wrappers
38
- for wrapper in [ "rustc-clif" , "cargo-clif" ] {
38
+ for wrapper in [ "rustc-clif" , "rustdoc-clif" , " cargo-clif"] {
39
39
let wrapper_name = get_wrapper_file_name ( wrapper, "bin" ) ;
40
40
41
41
let mut build_cargo_wrapper_cmd = Command :: new ( "rustc" ) ;
Original file line number Diff line number Diff line change
1
+ use std:: env;
2
+ use std:: ffi:: OsString ;
3
+ #[ cfg( unix) ]
4
+ use std:: os:: unix:: process:: CommandExt ;
5
+ use std:: path:: PathBuf ;
6
+ use std:: process:: Command ;
7
+
8
+ fn main ( ) {
9
+ let sysroot = PathBuf :: from ( env:: current_exe ( ) . unwrap ( ) . parent ( ) . unwrap ( ) ) ;
10
+
11
+ let cg_clif_dylib_path = sysroot. join ( if cfg ! ( windows) { "bin" } else { "lib" } ) . join (
12
+ env:: consts:: DLL_PREFIX . to_string ( ) + "rustc_codegen_cranelift" + env:: consts:: DLL_SUFFIX ,
13
+ ) ;
14
+
15
+ let mut args = std:: env:: args_os ( ) . skip ( 1 ) . collect :: < Vec < _ > > ( ) ;
16
+ args. push ( OsString :: from ( "-Cpanic=abort" ) ) ;
17
+ args. push ( OsString :: from ( "-Zpanic-abort-tests" ) ) ;
18
+ let mut codegen_backend_arg = OsString :: from ( "-Zcodegen-backend=" ) ;
19
+ codegen_backend_arg. push ( cg_clif_dylib_path) ;
20
+ args. push ( codegen_backend_arg) ;
21
+ if !args. contains ( & OsString :: from ( "--sysroot" ) ) {
22
+ args. push ( OsString :: from ( "--sysroot" ) ) ;
23
+ args. push ( OsString :: from ( sysroot. to_str ( ) . unwrap ( ) ) ) ;
24
+ }
25
+
26
+ // Ensure that the right toolchain is used
27
+ env:: set_var ( "RUSTUP_TOOLCHAIN" , env ! ( "RUSTUP_TOOLCHAIN" ) ) ;
28
+
29
+ #[ cfg( unix) ]
30
+ Command :: new ( "rustdoc" ) . args ( args) . exec ( ) ;
31
+
32
+ #[ cfg( not( unix) ) ]
33
+ std:: process:: exit (
34
+ Command :: new ( "rustdoc" ) . args ( args) . spawn ( ) . unwrap ( ) . wait ( ) . unwrap ( ) . code ( ) . unwrap_or ( 1 ) ,
35
+ ) ;
36
+ }
You can’t perform that action at this time.
0 commit comments