Skip to content

Commit d34e149

Browse files
authored
only set $CARGO if toolchain.cargo is set (#3275)
Follow-up from #3245: `toolchain.cargo` is optional and might be missing for some custom toolchains; only attempt to set it up if it's present.
1 parent b13b15f commit d34e149

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cargo/private/cargo_build_script.bzl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,12 @@ def _cargo_build_script_impl(ctx):
361361
if use_default_shell_env:
362362
env.update(ctx.configuration.default_shell_env)
363363

364+
if toolchain.cargo:
365+
env.update({
366+
"CARGO": "${{pwd}}/{}".format(toolchain.cargo.path),
367+
})
368+
364369
env.update({
365-
"CARGO": "${{pwd}}/{}".format(toolchain.cargo.path),
366370
"CARGO_CRATE_NAME": name_to_crate_name(pkg_name),
367371
"CARGO_MANIFEST_DIR": manifest_dir,
368372
"CARGO_PKG_NAME": pkg_name,

0 commit comments

Comments
 (0)