@@ -209,7 +209,7 @@ def _rust_library_common(ctx, crate_type):
209209 paths .replace_extension (rust_lib_name , ".rmeta" ),
210210 sibling = rust_lib ,
211211 )
212- rustc_rmeta_output = generate_output_diagnostics (ctx , rust_metadata )
212+ rustc_rmeta_output = generate_output_diagnostics (ctx , toolchain , rust_metadata )
213213 metadata_supports_pipelining = (
214214 can_use_metadata_for_pipelining (toolchain , crate_type ) and
215215 not ctx .attr .disable_pipelining
@@ -232,7 +232,7 @@ def _rust_library_common(ctx, crate_type):
232232 proc_macro_deps = proc_macro_deps ,
233233 aliases = ctx .attr .aliases ,
234234 output = rust_lib ,
235- rustc_output = generate_output_diagnostics (ctx , rust_lib ),
235+ rustc_output = generate_output_diagnostics (ctx , toolchain , rust_lib ),
236236 metadata = rust_metadata ,
237237 metadata_supports_pipelining = metadata_supports_pipelining ,
238238 rustc_rmeta_output = rustc_rmeta_output ,
@@ -282,7 +282,7 @@ def _rust_binary_impl(ctx):
282282 paths .replace_extension ("lib" + crate_name , ".rmeta" ),
283283 sibling = output ,
284284 )
285- rustc_rmeta_output = generate_output_diagnostics (ctx , rust_metadata )
285+ rustc_rmeta_output = generate_output_diagnostics (ctx , toolchain , rust_metadata )
286286
287287 providers = rustc_compile_action (
288288 ctx = ctx ,
@@ -297,7 +297,7 @@ def _rust_binary_impl(ctx):
297297 proc_macro_deps = proc_macro_deps ,
298298 aliases = ctx .attr .aliases ,
299299 output = output ,
300- rustc_output = generate_output_diagnostics (ctx , output ),
300+ rustc_output = generate_output_diagnostics (ctx , toolchain , output ),
301301 metadata = rust_metadata ,
302302 rustc_rmeta_output = rustc_rmeta_output ,
303303 edition = get_edition (ctx .attr , toolchain , ctx .label ),
@@ -394,7 +394,7 @@ def _rust_test_impl(ctx):
394394 paths .replace_extension ("lib" + crate_name , ".rmeta" ),
395395 sibling = output ,
396396 )
397- rustc_rmeta_output = generate_output_diagnostics (ctx , rust_metadata )
397+ rustc_rmeta_output = generate_output_diagnostics (ctx , toolchain , rust_metadata )
398398
399399 # Need to consider all src files together when transforming
400400 srcs = depset (ctx .files .srcs , transitive = [crate .srcs ]).to_list ()
@@ -429,7 +429,7 @@ def _rust_test_impl(ctx):
429429 proc_macro_deps = depset (proc_macro_deps , transitive = [crate .proc_macro_deps ]).to_list (),
430430 aliases = aliases ,
431431 output = output ,
432- rustc_output = generate_output_diagnostics (ctx , output ),
432+ rustc_output = generate_output_diagnostics (ctx , toolchain , output ),
433433 metadata = rust_metadata ,
434434 rustc_rmeta_output = rustc_rmeta_output ,
435435 edition = crate .edition ,
@@ -473,7 +473,7 @@ def _rust_test_impl(ctx):
473473 paths .replace_extension ("lib" + crate_name , ".rmeta" ),
474474 sibling = output ,
475475 )
476- rustc_rmeta_output = generate_output_diagnostics (ctx , rust_metadata )
476+ rustc_rmeta_output = generate_output_diagnostics (ctx , toolchain , rust_metadata )
477477
478478 if ctx .attr .rustc_env :
479479 rustc_env = expand_dict_value_locations (
@@ -495,7 +495,7 @@ def _rust_test_impl(ctx):
495495 proc_macro_deps = proc_macro_deps ,
496496 aliases = ctx .attr .aliases ,
497497 output = output ,
498- rustc_output = generate_output_diagnostics (ctx , output ),
498+ rustc_output = generate_output_diagnostics (ctx , toolchain , output ),
499499 metadata = rust_metadata ,
500500 rustc_rmeta_output = rustc_rmeta_output ,
501501 edition = get_edition (ctx .attr , toolchain , ctx .label ),
@@ -645,13 +645,6 @@ RUSTC_ATTRS = {
645645 "_per_crate_rustc_flag" : attr .label (
646646 default = Label ("//rust/settings:experimental_per_crate_rustc_flag" ),
647647 ),
648- "_process_wrapper" : attr .label (
649- doc = "A process wrapper for running rustc on all platforms." ,
650- default = Label ("//util/process_wrapper" ),
651- executable = True ,
652- allow_single_file = True ,
653- cfg = "exec" ,
654- ),
655648 "_rustc_output_diagnostics" : attr .label (
656649 default = Label ("//rust/settings:rustc_output_diagnostics" ),
657650 ),
@@ -1318,21 +1311,6 @@ rust_binary = rule(
13181311def _common_attrs_for_binary_without_process_wrapper (attrs ):
13191312 new_attr = dict (attrs )
13201313
1321- # use a fake process wrapper
1322- new_attr ["_process_wrapper" ] = attr .label (
1323- default = None ,
1324- executable = True ,
1325- allow_single_file = True ,
1326- cfg = "exec" ,
1327- )
1328-
1329- new_attr ["_bootstrap_process_wrapper" ] = attr .label (
1330- default = Label ("//util/process_wrapper:bootstrap_process_wrapper" ),
1331- executable = True ,
1332- allow_single_file = True ,
1333- cfg = "exec" ,
1334- )
1335-
13361314 # fix stamp = 0
13371315 new_attr ["stamp" ] = attr .int (
13381316 doc = dedent ("""\
@@ -1350,20 +1328,31 @@ _RustBuiltWithoutProcessWrapperInfo = provider(
13501328 fields = {},
13511329)
13521330
1331+ def _bootstrap_process_wrapper_transition_impl (_settings , _attr ):
1332+ return {str (Label ("//rust/private:bootstrap_setting" )): True }
1333+
1334+ _bootstrap_process_wrapper_transition = transition (
1335+ implementation = _bootstrap_process_wrapper_transition_impl ,
1336+ inputs = [],
1337+ outputs = [str (Label ("//rust/private:bootstrap_setting" ))],
1338+ )
1339+
13531340def _rust_binary_without_process_wrapper_impl (ctx ):
13541341 providers = _rust_binary_impl (ctx )
13551342 return providers + [_RustBuiltWithoutProcessWrapperInfo ()]
13561343
1357- # Provides an internal rust_{binary,library} to use that we can use to build the process
1358- # wrapper, this breaks the dependency of rust_* on the process wrapper by
1359- # setting it to None, which the functions in rustc detect and build accordingly.
13601344rust_binary_without_process_wrapper = rule (
13611345 implementation = _rust_binary_without_process_wrapper_impl ,
13621346 doc = "A variant of `rust_binary` that uses a minimal process wrapper for `Rustc` actions." ,
13631347 provides = COMMON_PROVIDERS + [_RustBuiltWithoutProcessWrapperInfo ],
1364- attrs = _common_attrs_for_binary_without_process_wrapper (_common_attrs | _rust_binary_attrs ),
1348+ attrs = _common_attrs_for_binary_without_process_wrapper (_common_attrs | _rust_binary_attrs ) | {
1349+ "_allowlist_function_transition" : attr .label (
1350+ default = Label ("//tools/allowlists/function_transition_allowlist" ),
1351+ ),
1352+ },
13651353 executable = True ,
13661354 fragments = ["cpp" ],
1355+ cfg = _bootstrap_process_wrapper_transition ,
13671356 toolchains = [
13681357 str (Label ("//rust:toolchain_type" )),
13691358 config_common .toolchain_type ("@bazel_tools//tools/cpp:toolchain_type" , mandatory = False ),
0 commit comments