Skip to content

Outside of examples, fill in all edition attrs #1257

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

Merged
merged 1 commit into from
Apr 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cargo/bootstrap/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ rust_binary(
srcs = [
"bootstrap_installer.rs",
],
edition = "2018",
rustc_env = {
"RULES_RUST_CARGO_BOOTSTRAP_BINARY": "$(rootpath bootstrap_installer.rs)",
},
Expand Down
2 changes: 2 additions & 0 deletions crate_universe/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ rust_library(
include = ["src/**"],
exclude = ["src/**/*.rs"],
),
edition = "2018",
proc_macro_deps = all_crate_deps(proc_macro = True),
version = VERSION,
visibility = ["//visibility:public"],
Expand All @@ -75,6 +76,7 @@ rust_library(
rust_binary(
name = "cargo_bazel_bin",
srcs = ["src/main.rs"],
edition = "2018",
version = VERSION,
visibility = ["//visibility:public"],
deps = [":cargo_bazel"],
Expand Down
1 change: 1 addition & 0 deletions crate_universe/tools/cross_installer/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ rust_binary(
":cross",
"@rules_rust//rust/toolchain:current_exec_cargo_files",
],
edition = "2018",
proc_macro_deps = all_crate_deps(proc_macro = True),
rustc_env = {
"CARGO": "$(rootpath @rules_rust//rust/toolchain:current_exec_cargo_files)",
Expand Down
1 change: 1 addition & 0 deletions crate_universe/tools/urls_generator/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ rust_binary(
compile_data = [
"//crate_universe/private:urls.bzl",
],
edition = "2018",
proc_macro_deps = all_crate_deps(proc_macro = True),
rustc_env = {
"MODULE_ROOT_PATH": "$(rootpath //crate_universe/private:urls.bzl)",
Expand Down
5 changes: 4 additions & 1 deletion examples/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_regi

rules_rust_dependencies()

rust_register_toolchains(include_rustc_srcs = True)
rust_register_toolchains(
edition = "2018",
include_rustc_srcs = True,
)

load("@rules_rust//bindgen:repositories.bzl", "rust_bindgen_repositories")

Expand Down
2 changes: 1 addition & 1 deletion examples/cargo_manifest_dir/external_crate/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ local_repository(

load("@rules_rust//rust:repositories.bzl", "rust_repositories")

rust_repositories()
rust_repositories(edition = "2018")
5 changes: 4 additions & 1 deletion examples/crate_universe/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_regi

rules_rust_dependencies()

rust_register_toolchains(include_rustc_srcs = True)
rust_register_toolchains(
edition = "2018",
include_rustc_srcs = True,
)

load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")

Expand Down
6 changes: 5 additions & 1 deletion proto/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ toolchain_type(name = "toolchain")
rust_binary(
name = "optional_output_wrapper",
srcs = ["optional_output_wrapper.rs"],
edition = "2018",
visibility = ["//visibility:public"],
)

Expand All @@ -43,7 +44,10 @@ toolchain(
toolchain_type = "@rules_rust//proto:toolchain",
)

rust_proto_toolchain(name = "default-proto-toolchain-impl")
rust_proto_toolchain(
name = "default-proto-toolchain-impl",
edition = "2018",
)

bzl_library(
name = "bzl_lib",
Expand Down
5 changes: 5 additions & 0 deletions test/build_env/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ rust_test(
name = "conflicting_deps_test",
srcs = ["tests/manifest_dir.rs"],
data = ["src/manifest_dir_file.txt"],
edition = "2018",
)

rust_test(
name = "arbitrary_env_test",
srcs = ["tests/arbitrary_env.rs"],
edition = "2018",
rustc_env = {
"USER_DEFINED_KEY": "USER_DEFINED_VALUE",
},
Expand All @@ -24,17 +26,20 @@ rust_test(
# Intentionally uses a mix of -s and _s because those normalisations are part of what is being tested.
name = "cargo_env-vars_test",
srcs = ["tests/cargo.rs"],
edition = "2018",
deps = [":cargo_build_script_env-vars_build_script"],
)

rust_test(
name = "cargo-env-vars-custom-crate-name-test",
srcs = ["tests/custom_crate_name.rs"],
crate_name = "custom_crate_name",
edition = "2018",
deps = [":cargo_build_script_env-vars_build_script"],
)

cargo_build_script(
name = "cargo_build_script_env-vars_build_script",
srcs = ["src/build.rs"],
edition = "2018",
)
2 changes: 2 additions & 0 deletions test/cargo_build_script/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ cargo_build_script(
name = "tools_exec_build_rs",
srcs = ["build.rs"],
build_script_env = {"TOOL": "$(execpath :tool)"},
edition = "2018",
# Add a flag to test that they're exposed to the build script
rustc_flags = ["--verbose"],
tools = [":tool"],
Expand All @@ -23,5 +24,6 @@ genrule(
rust_test(
name = "tools_exec",
srcs = ["tools_exec.rs"],
edition = "2018",
deps = [":tools_exec_build_rs"],
)
6 changes: 6 additions & 0 deletions test/chained_direct_deps/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@ load("//rust:defs.bzl", "rust_doc_test", "rust_library", "rust_test")
rust_library(
name = "mod1",
srcs = ["mod1.rs"],
edition = "2018",
)

rust_library(
name = "mod2",
srcs = ["mod2.rs"],
edition = "2018",
deps = [":mod1"],
)

rust_library(
name = "mod3",
srcs = ["mod3.rs"],
edition = "2018",
deps = [
":mod1",
":mod2",
Expand All @@ -23,16 +26,19 @@ rust_library(
rust_test(
name = "mod1_test",
crate = ":mod1",
edition = "2018",
)

rust_test(
name = "mod2_test",
crate = ":mod2",
edition = "2018",
)

rust_test(
name = "mod3_test",
crate = ":mod3",
edition = "2018",
)

rust_doc_test(
Expand Down
2 changes: 2 additions & 0 deletions test/extra_exec_rustc_flags/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package(default_visibility = ["//test:__subpackages__"])
rust_library(
name = "lib_do_not_build_directly",
srcs = ["lib.rs"],
edition = "2018",
tags = ["manual"],
)

Expand All @@ -36,6 +37,7 @@ with_exec_cfg(
rust_library(
name = "lib_no_exec",
srcs = ["lib_no_exec.rs"],
edition = "2018",
)

with_extra_exec_rustc_flags_cfg(
Expand Down
1 change: 1 addition & 0 deletions test/inline_test_with_deps/dep/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ package(default_visibility = ["//visibility:public"])
rust_library(
name = "dep",
srcs = ["src/lib.rs"],
edition = "2018",
)
1 change: 1 addition & 0 deletions test/inline_test_with_deps/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ rust_library(
rust_test(
name = "inline_test",
crate = ":inline",
edition = "2018",
deps = ["//test/inline_test_with_deps/dep"],
)
4 changes: 4 additions & 0 deletions test/out_dir_in_tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,22 @@ load("//rust:defs.bzl", "rust_library", "rust_test", "rust_test_suite")
cargo_build_script(
name = "build_script",
srcs = ["build.rs"],
edition = "2018",
)

rust_library(
name = "demo_lib",
srcs = [
"src/lib.rs",
],
edition = "2018",
deps = [":build_script"],
)

rust_test(
name = "demo_lib_test",
crate = ":demo_lib",
edition = "2018",
)

rust_test_suite(
Expand All @@ -26,4 +29,5 @@ rust_test_suite(
# to the underlying rust_test rules. This will make OUT_DIR
# available when compiling integration tests.
crate = ":demo_lib",
edition = "2018",
)
2 changes: 2 additions & 0 deletions test/process_wrapper/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ build_test(
rust_binary(
name = "fake_rustc",
srcs = ["fake_rustc.rs"],
edition = "2018",
)

rust_test(
Expand All @@ -162,5 +163,6 @@ rust_test(
":fake_rustc",
"//util/process_wrapper",
],
edition = "2018",
deps = ["//tools/runfiles"],
)
6 changes: 6 additions & 0 deletions test/renamed_deps/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ load("//rust:defs.bzl", "rust_library", "rust_test")
rust_library(
name = "mod1",
srcs = ["mod1.rs"],
edition = "2018",
)

rust_library(
name = "mod2",
srcs = ["mod2.rs"],
edition = "2018",
deps = [":mod1"],
)

Expand All @@ -18,6 +20,7 @@ rust_library(
":mod1": "alias_a",
":mod2": "alias_b",
},
edition = "2018",
deps = [
":mod1",
":mod2",
Expand All @@ -27,11 +30,13 @@ rust_library(
rust_test(
name = "mod1_test",
crate = ":mod1",
edition = "2018",
)

rust_test(
name = "mod2_test",
crate = ":mod2",
edition = "2018",
)

rust_test(
Expand All @@ -41,4 +46,5 @@ rust_test(
":mod2": "alias_b",
},
crate = ":mod3",
edition = "2018",
)
2 changes: 2 additions & 0 deletions test/rust/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ rust_library(
"src/greeter.rs",
"src/lib.rs",
],
edition = "2018",
)

rust_binary(
name = "hello_world",
srcs = ["src/main.rs"],
edition = "2018",
deps = [":hello_lib"],
)
10 changes: 10 additions & 0 deletions test/rust_analyzer/aspect_traversal_test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ load(":custom_alias.bzl", "custom_alias")
rust_library(
name = "mylib",
srcs = ["mylib.rs"],
edition = "2018",
proc_macro_deps = [":proc_macro_dep"],
deps = [
":alias_dep",
Expand All @@ -15,6 +16,7 @@ rust_library(
rust_library(
name = "lib_dep",
srcs = ["lib_dep.rs"],
edition = "2018",
)

alias(
Expand All @@ -25,12 +27,14 @@ alias(
rust_library(
name = "actual_dep",
srcs = ["actual_dep.rs"],
edition = "2018",
deps = [":dep_of_aliased_dep"],
)

rust_library(
name = "dep_of_aliased_dep",
srcs = ["dep_of_aliased_dep.rs"],
edition = "2018",
)

custom_alias(
Expand All @@ -41,34 +45,40 @@ custom_alias(
rust_library(
name = "custom_actual_dep",
srcs = ["custom_actual_dep.rs"],
edition = "2018",
deps = [":dep_of_custom_aliased_dep"],
)

rust_library(
name = "dep_of_custom_aliased_dep",
srcs = ["dep_of_custom_aliased_dep.rs"],
edition = "2018",
)

rust_proc_macro(
name = "proc_macro_dep",
srcs = ["proc_macro_dep.rs"],
edition = "2018",
)

rust_test(
name = "mylib_test",
crate = ":mylib",
edition = "2018",
proc_macro_deps = [":extra_proc_macro_dep"],
deps = [":extra_test_dep"],
)

rust_library(
name = "extra_test_dep",
srcs = ["extra_test_dep.rs"],
edition = "2018",
)

rust_proc_macro(
name = "extra_proc_macro_dep",
srcs = ["extra_proc_macro_dep.rs"],
edition = "2018",
)

rust_test(
Expand Down
Loading