Skip to content
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

Merged
merged 4 commits into from
Dec 11, 2018

Conversation

mfarrugi
Copy link
Collaborator

@mfarrugi mfarrugi commented Dec 8, 2018

Fairly simple change, backwards compatible through optional/default parameters.

rust_toolchain.default_edition is not practically useful until cargo-raze is providing edition.

@@ -9,6 +9,7 @@ load(

rust_binary(
name = "hello_runfiles",
edition = "2018",
Copy link
Collaborator Author

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.

@@ -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.",
Copy link
Collaborator Author

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

@mfarrugi
Copy link
Collaborator Author

mfarrugi commented Dec 8, 2018

Ah forgot, need to update rustc to 1.31 in this repo.. will get to that a little later.

rust/private/rustc.bzl Outdated Show resolved Hide resolved
@mfarrugi
Copy link
Collaborator Author

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 []
Copy link
Collaborator

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?

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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

@mfarrugi mfarrugi merged commit 3228ccd into bazelbuild:master Dec 11, 2018
@mfarrugi mfarrugi deleted the marco-edition-support branch October 19, 2020 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants