File tree 2 files changed +14
-0
lines changed
2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -120,6 +120,19 @@ def rustdoc_compile_action(
120
120
force_link = True ,
121
121
)
122
122
123
+ # Because rustdoc tests compile tests outside of the sandbox, the sysroot
124
+ # must be updated to the `short_path` equivilant as it will now be
125
+ # a part of runfiles.
126
+ if is_test :
127
+ # Determine what the `short_path` would be for the sysroot
128
+ sysroot , _ , _ = toolchain .sysroot_anchor .short_path .rpartition ("/" )
129
+
130
+ env .update ({"SYSROOT" : "${{pwd}}/{}" .format (sysroot )})
131
+
132
+ # `rustdoc` does not support the SYSROOT environment variable. To account
133
+ # for this, the flag must be explicitly passed to the `rustdoc` binary.
134
+ args .rustc_flags .add ("--sysroot=${{pwd}}/{}" .format (sysroot ))
135
+
123
136
return struct (
124
137
executable = ctx .executable ._process_wrapper ,
125
138
inputs = depset ([crate_info .output ], transitive = [compile_inputs ]),
Original file line number Diff line number Diff line change @@ -293,6 +293,7 @@ def _rust_toolchain_impl(ctx):
293
293
rust_std_paths = depset ([file .dirname for file in sysroot .rust_std .to_list ()]),
294
294
rust_lib = sysroot .rust_std , # `rust_lib` is deprecated and only exists for legacy support.
295
295
sysroot = sysroot .sysroot_anchor .dirname ,
296
+ sysroot_anchor = sysroot .sysroot_anchor ,
296
297
binary_ext = ctx .attr .binary_ext ,
297
298
staticlib_ext = ctx .attr .staticlib_ext ,
298
299
dylib_ext = ctx .attr .dylib_ext ,
You can’t perform that action at this time.
0 commit comments