-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removed rust_toolchain.os
in favor of rust_toolchain.exec_triple
.
#1960
Conversation
c156ca8
to
76946eb
Compare
@@ -1822,10 +1818,10 @@ def _add_native_link_flags(args, dep_info, linkstamp_outs, ambiguous_libs, crate | |||
|
|||
use_pic = _should_use_pic(cc_toolchain, feature_configuration, crate_type, compilation_mode) | |||
|
|||
if toolchain.os == "windows": | |||
if toolchain.target_os == "windows": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could be wrong but I think this section has a mixed use of the "os". The formatting of the link flags would be dependent on what tools are being used (MSVC's link.exe
vs gcc
). This may be something to address in #1958 but worth considering in this change as well.
exec_os = exec_triple.system | ||
|
||
if not exec_os: | ||
if not exec_triple.system: | ||
fail("No system was provided for the execution platform. Please update {}".format( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this fail could probably be removed but not entirely sure.
76946eb
to
3781a54
Compare
What's the benefit to introducing |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thank you!
…bazelbuild#1960) * Removed `rust_toolchain.os` in favor of `rust_toolchain.exec_triple`. * Regenerate documentation
…bazelbuild#1960) * Removed `rust_toolchain.os` in favor of `rust_toolchain.exec_triple`. * Regenerate documentation
rust_toolchain.exec_triple
has been a mandatory field for years (f1b8fd3) but by maintaining legacy behavior, there's now an opportunity for users to define misleading toolchains whererust_toolchain.os
is ambiguous and/or doesn't matchrust_toolchain.exec_triple
.Changes:
os
attribute fromrust_toolchain
target_os
to the toolchain provider which is derived from thetarget_triple
ortarget_json
attributes.os
field on the toolchain provider withtarget_os
as it's clearer and more matches prior art with Cargo custom targets.Note that all uses of
toolchain.os
have been replaced withtoolchain.target_os
to avoid a change in behavior.rust_toolchain.os
was near universally set to the target triple (see repository_utils.bzl) unless users defined their own toolchains without usingrules_rust
repository rules. That said, the use oftarget_os
may not be correct in all it's uses today.