Skip to content

Commit 557ee91

Browse files
Nikita Patskovfacebook-github-bot
authored andcommitted
Enable transformation spec for rust with static linking
Summary: Transformation specs should also be available for Rust (mostly to migrate off link group-based APIs that is currently rolled out for rust too). Thankfully this is easy to configure because all we should do is to propagate the values and all handling will work out of the box. Passing transformation spec context to part that handles static linkage Reviewed By: dtolnay Differential Revision: D83559463 fbshipit-source-id: bf7f71152cec516c3d12d2a36657f0cb925b0520
1 parent b618de3 commit 557ee91

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

prelude/rust/build.bzl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ load(
3636
"get_output_flags",
3737
"get_shared_library_name_linker_flags",
3838
)
39+
load(
40+
"@prelude//cxx:transformation_spec.bzl",
41+
"TransformationSpecContext", # @unused Used as a type
42+
)
3943
load(
4044
"@prelude//linking:link_info.bzl",
4145
"LibOutputStyle", # @unused Used as a type
@@ -392,6 +396,7 @@ def rust_compile(
392396
# output of the action is going to be depended on
393397
infallible_diagnostics: bool = False,
394398
rust_cxx_link_group_info: RustCxxLinkGroupInfo | None = None,
399+
transformation_spec_context: TransformationSpecContext | None = None,
395400
profile_mode: ProfileMode | None = None) -> RustcOutput:
396401
toolchain_info = compile_ctx.toolchain_info
397402

@@ -563,7 +568,7 @@ def rust_compile(
563568
link_strategy = params.dep_link_strategy,
564569
swiftmodule_linkable = None,
565570
prefer_stripped = False,
566-
transformation_spec_context = None,
571+
transformation_spec_context = transformation_spec_context,
567572
)
568573

569574
if params.crate_type in (CrateType("cdylib"), CrateType("dylib")):

prelude/rust/rust_binary.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ def _rust_binary_common(
216216
extra_flags = extra_flags,
217217
allow_cache_upload = allow_cache_upload,
218218
rust_cxx_link_group_info = rust_cxx_link_group_info,
219+
transformation_spec_context = transformation_spec_context,
219220
incremental_enabled = ctx.attrs.incremental_enabled,
220221
)
221222

@@ -331,6 +332,7 @@ def _rust_binary_common(
331332
extra_flags = extra_flags,
332333
infallible_diagnostics = True,
333334
incremental_enabled = incr,
335+
transformation_spec_context = transformation_spec_context,
334336
)
335337
clippy_artifacts[incr] = rust_compile(
336338
ctx = ctx,
@@ -341,6 +343,7 @@ def _rust_binary_common(
341343
extra_flags = extra_flags,
342344
infallible_diagnostics = True,
343345
incremental_enabled = incr,
346+
transformation_spec_context = transformation_spec_context,
344347
)
345348

346349
providers = [RustcExtraOutputsInfo(

0 commit comments

Comments
 (0)