Enforce edition on all Bazel targets

This commit is contained in:
David Tolnay
2022-04-10 18:06:09 -07:00
parent 26e57ad773
commit c52be62f22
6 changed files with 34 additions and 10 deletions
+5
View File
@@ -8,6 +8,7 @@ rust_library(
"alloc",
"std",
],
edition = "2018",
proc_macro_deps = [
":cxxbridge-macro",
],
@@ -19,6 +20,7 @@ rust_binary(
name = "codegen",
srcs = glob(["gen/cmd/src/**/*.rs"]),
data = ["gen/cmd/src/gen/include/cxx.h"],
edition = "2018",
visibility = ["//visibility:public"],
deps = [
"//third-party:clap",
@@ -46,6 +48,7 @@ cc_library(
rust_proc_macro(
name = "cxxbridge-macro",
srcs = glob(["macro/src/**"]),
edition = "2018",
deps = [
"//third-party:proc-macro2",
"//third-party:quote",
@@ -57,6 +60,7 @@ rust_library(
name = "build",
srcs = glob(["gen/build/src/**/*.rs"]),
data = ["gen/build/src/gen/include/cxx.h"],
edition = "2018",
visibility = ["//visibility:public"],
deps = [
"//third-party:cc",
@@ -73,6 +77,7 @@ rust_library(
name = "lib",
srcs = glob(["gen/lib/src/**/*.rs"]),
data = ["gen/lib/src/gen/include/cxx.h"],
edition = "2018",
visibility = ["//visibility:public"],
deps = [
"//third-party:cc",
+1 -4
View File
@@ -16,10 +16,7 @@ load("@rules_rust//rust:repositories.bzl", "rust_repositories")
RUST_VERSION = "1.57.0"
rust_repositories(
edition = "2018",
version = RUST_VERSION,
)
rust_repositories(version = RUST_VERSION)
load("//tools/bazel:vendor.bzl", "vendor")
+1
View File
@@ -5,6 +5,7 @@ load("//tools/bazel:rust_cxx_bridge.bzl", "rust_cxx_bridge")
rust_binary(
name = "demo",
srcs = glob(["src/**/*.rs"]),
edition = "2018",
deps = [
":blobstore-sys",
":bridge",
+2
View File
@@ -6,6 +6,7 @@ rust_test(
name = "test",
size = "small",
srcs = ["test.rs"],
edition = "2018",
deps = [
":cxx_test_suite",
"//:cxx",
@@ -19,6 +20,7 @@ rust_library(
"ffi/lib.rs",
"ffi/module.rs",
],
edition = "2018",
deps = [
":impl",
"//:cxx",
+19
View File
@@ -8,11 +8,13 @@ load(
rust_library(
name = "bitflags",
srcs = glob(["vendor/bitflags-1.3.2/src/**"]),
edition = "2018",
)
rust_library(
name = "cc",
srcs = glob(["vendor/cc-1.0.73/src/**"]),
edition = "2018",
visibility = ["//visibility:public"],
)
@@ -20,6 +22,7 @@ rust_library(
name = "clap",
srcs = glob(["vendor/clap-3.1.6/src/**"]),
crate_features = ["std"],
edition = "2018",
visibility = ["//visibility:public"],
deps = [
":bitflags",
@@ -32,6 +35,7 @@ rust_library(
rust_library(
name = "codespan-reporting",
srcs = glob(["vendor/codespan-reporting-0.11.1/src/**"]),
edition = "2018",
visibility = ["//visibility:public"],
deps = [
":termcolor",
@@ -43,12 +47,14 @@ rust_library(
name = "hashbrown",
srcs = glob(["vendor/hashbrown-0.11.2/src/**"]),
crate_features = ["raw"],
edition = "2018",
)
rust_library(
name = "indexmap",
srcs = glob(["vendor/indexmap-1.8.0/src/**"]),
crate_features = ["std"],
edition = "2018",
rustc_flags = ["--cfg=has_std"],
deps = [":hashbrown"],
)
@@ -57,6 +63,7 @@ rust_library(
name = "memchr",
srcs = glob(["vendor/memchr-2.4.1/src/**/*.rs"]),
crate_features = ["std"],
edition = "2018",
)
rust_library(
@@ -66,6 +73,7 @@ rust_library(
"alloc",
"std",
],
edition = "2018",
visibility = ["//visibility:public"],
)
@@ -76,6 +84,7 @@ rust_library(
"memchr",
"raw_os_str",
],
edition = "2018",
deps = [":memchr"],
)
@@ -86,6 +95,7 @@ rust_library(
"proc-macro",
"span-locations",
],
edition = "2018",
visibility = ["//visibility:public"],
deps = [
":proc-macro2@build",
@@ -101,12 +111,14 @@ cargo_build_script(
"span-locations",
],
crate_name = "build",
edition = "2018",
)
rust_library(
name = "quote",
srcs = glob(["vendor/quote-1.0.15/src/**"]),
crate_features = ["proc-macro"],
edition = "2018",
visibility = ["//visibility:public"],
deps = [":proc-macro2"],
)
@@ -114,6 +126,7 @@ rust_library(
rust_library(
name = "scratch",
srcs = glob(["vendor/scratch-1.0.1/src/**"]),
edition = "2018",
rustc_env = {"OUT_DIR": ""},
visibility = ["//visibility:public"],
)
@@ -129,6 +142,7 @@ rust_library(
"printing",
"proc-macro",
],
edition = "2018",
visibility = ["//visibility:public"],
deps = [
":proc-macro2",
@@ -150,25 +164,30 @@ cargo_build_script(
"proc-macro",
],
crate_name = "build",
edition = "2018",
)
rust_library(
name = "termcolor",
srcs = glob(["vendor/termcolor-1.1.3/src/**"]),
edition = "2018",
)
rust_library(
name = "textwrap",
srcs = glob(["vendor/textwrap-0.15.0/src/**"]),
edition = "2018",
deps = [":unicode-width"],
)
rust_library(
name = "unicode-width",
srcs = glob(["vendor/unicode-width-0.1.9/src/**"]),
edition = "2018",
)
rust_library(
name = "unicode-xid",
srcs = glob(["vendor/unicode-xid-0.2.2/src/**"]),
edition = "2018",
)
+6 -6
View File
@@ -5,14 +5,14 @@ load("@third-party//:vendor.bzl", "vendored")
def third_party_glob(include):
return vendored and native.glob(include)
def third_party_cargo_build_script(rustc_flags = [], **kwargs):
def third_party_cargo_build_script(edition, rustc_flags = [], **kwargs):
rustc_flags = rustc_flags + ["--cap-lints=allow"]
cargo_build_script(rustc_flags = rustc_flags, **kwargs)
cargo_build_script(edition = edition, rustc_flags = rustc_flags, **kwargs)
def third_party_rust_binary(rustc_flags = [], **kwargs):
def third_party_rust_binary(edition, rustc_flags = [], **kwargs):
rustc_flags = rustc_flags + ["--cap-lints=allow"]
rust_binary(rustc_flags = rustc_flags, **kwargs)
rust_binary(edition = edition, rustc_flags = rustc_flags, **kwargs)
def third_party_rust_library(rustc_flags = [], **kwargs):
def third_party_rust_library(edition, rustc_flags = [], **kwargs):
rustc_flags = rustc_flags + ["--cap-lints=allow"]
rust_library(rustc_flags = rustc_flags, **kwargs)
rust_library(edition = edition, rustc_flags = rustc_flags, **kwargs)