Skip to content

Commit d2d2ece

Browse files
authored
cleanup: replace crate_type argument with crate_info.type (#864)
* replace crate_type arg with crate_info.type * update proto.bzl
1 parent 72cc0aa commit d2d2ece

File tree

4 files changed

+1
-11
lines changed

4 files changed

+1
-11
lines changed

proto/proto.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ def _rust_proto_compile(protos, descriptor_sets, imports, crate_name, ctx, is_gr
221221
return rustc_compile_action(
222222
ctx = ctx,
223223
toolchain = find_toolchain(ctx),
224-
crate_type = "rlib",
225224
crate_info = rust_common.create_crate_info(
226225
name = crate_name,
227226
type = "rlib",

rust/private/clippy.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ def _clippy_aspect_impl(target, ctx):
8787
toolchain.clippy_driver.path,
8888
cc_toolchain,
8989
feature_configuration,
90-
crate_type,
9190
crate_info,
9291
dep_info,
9392
output_hash = determine_output_hash(crate_info.root),

rust/private/rust.bzl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ def _rust_library_common(ctx, crate_type):
253253
return rustc_compile_action(
254254
ctx = ctx,
255255
toolchain = toolchain,
256-
crate_type = crate_type,
257256
crate_info = rust_common.create_crate_info(
258257
name = crate_name,
259258
type = crate_type,
@@ -289,7 +288,6 @@ def _rust_binary_impl(ctx):
289288
return rustc_compile_action(
290289
ctx = ctx,
291290
toolchain = toolchain,
292-
crate_type = ctx.attr.crate_type,
293291
crate_info = rust_common.create_crate_info(
294292
name = crate_name,
295293
type = ctx.attr.crate_type,
@@ -450,7 +448,6 @@ def _rust_test_common(ctx, toolchain, output):
450448
providers = rustc_compile_action(
451449
ctx = ctx,
452450
toolchain = toolchain,
453-
crate_type = crate_type,
454451
crate_info = crate_info,
455452
rust_flags = ["--test"] if ctx.attr.use_libtest_harness else ["--cfg", "test"],
456453
)

rust/private/rustc.bzl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ def construct_arguments(
334334
tool_path,
335335
cc_toolchain,
336336
feature_configuration,
337-
crate_type,
338337
crate_info,
339338
dep_info,
340339
output_hash,
@@ -353,7 +352,6 @@ def construct_arguments(
353352
tool_path (str): Path to rustc
354353
cc_toolchain (CcToolchain): The CcToolchain for the current target.
355354
feature_configuration (FeatureConfiguration): Class used to construct command lines from CROSSTOOL features.
356-
crate_type (str): Crate type of the current target.
357355
crate_info (CrateInfo): The CrateInfo provider of the target crate
358356
dep_info (DepInfo): The DepInfo provider of the target crate
359357
output_hash (str): The hashed path of the crate root
@@ -489,7 +487,7 @@ def construct_arguments(
489487
rustc_flags.add("--codegen=linker=" + ld)
490488
rustc_flags.add_joined("--codegen", link_args, join_with = " ", format_joined = "link-args=%s")
491489

492-
_add_native_link_flags(rustc_flags, dep_info, crate_type, toolchain, cc_toolchain, feature_configuration)
490+
_add_native_link_flags(rustc_flags, dep_info, crate_info.type, toolchain, cc_toolchain, feature_configuration)
493491

494492
# These always need to be added, even if not linking this crate.
495493
add_crate_link_flags(rustc_flags, dep_info)
@@ -531,7 +529,6 @@ def construct_arguments(
531529
def rustc_compile_action(
532530
ctx,
533531
toolchain,
534-
crate_type,
535532
crate_info,
536533
output_hash = None,
537534
rust_flags = [],
@@ -541,7 +538,6 @@ def rustc_compile_action(
541538
Args:
542539
ctx (ctx): The rule's context object
543540
toolchain (rust_toolchain): The current `rust_toolchain`
544-
crate_type (str): Crate type of the current target
545541
crate_info (CrateInfo): The CrateInfo provider for the current target.
546542
output_hash (str, optional): The hashed path of the crate root. Defaults to None.
547543
rust_flags (list, optional): Additional flags to pass to rustc. Defaults to [].
@@ -581,7 +577,6 @@ def rustc_compile_action(
581577
toolchain.rustc.path,
582578
cc_toolchain,
583579
feature_configuration,
584-
crate_type,
585580
crate_info,
586581
dep_info,
587582
output_hash,

0 commit comments

Comments
 (0)