-
Notifications
You must be signed in to change notification settings - Fork 402
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
Add edition support to rules and toolchain. (#157) #168
Conversation
@@ -9,6 +9,7 @@ load( | |||
|
|||
rust_binary( | |||
name = "hello_runfiles", | |||
edition = "2018", |
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.
My plan is to use default_edition = "2018"
, and use edition = "2015"
for stragglers.
rust/private/rust.bzl
Outdated
@@ -183,6 +183,9 @@ _rust_common_attrs = { | |||
), | |||
"deps": attr.label_list(), | |||
"crate_features": attr.string_list(), | |||
"edition": attr.string( | |||
doc = "The rust edition to use for this crate.", |
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.
This is apparently the way forward, added note in #140
Ah forgot, need to update rustc to 1.31 in this repo.. will get to that a little later. |
643a1c8
to
054a478
Compare
054a478
to
a7ddf39
Compare
Should be good now, lmk. |
link_search_flags += ["-Ldependency={}".format(dirname(c.output.short_path)) for c in d.transitive_crates.to_list()] | ||
|
||
link_flags += ["-ldylib=" + get_lib_name(lib) for lib in d.transitive_dylibs.to_list()] | ||
link_search_flags += ["-Lnative={}".format(dirname(lib.short_path)) for lib in d.transitive_dylibs.to_list()] | ||
link_flags += ["-lstatic=" + get_lib_name(lib) for lib in d.transitive_staticlibs.to_list()] | ||
link_search_flags += ["-Lnative={}".format(dirname(lib.short_path)) for lib in d.transitive_staticlibs.to_list()] | ||
|
||
edition_flags = ["--edition={}".format(crate.edition)] if crate.edition != "2015" else [] |
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.
Really minor nit: Can this be converted to use the add_addition_flag fn?
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 couldn't think of a way to get the fn to work on both 'args' and 'list
i'll take a look at the rustdoc_test todo to use args
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.
filed bazelbuild/bazel#6888 for args issue
Fairly simple change, backwards compatible through optional/default parameters.
rust_toolchain.default_edition
is not practically useful until cargo-raze is providing edition.