From 79051bdee361d83713d5cb0210528250752a2f83 Mon Sep 17 00:00:00 2001 From: Augie Fackler Date: Wed, 12 Jan 2022 14:21:58 -0500 Subject: [PATCH 1/2] optimization: switch fastbuild opt default to 1 from 0 This will very slightly increase build times but applies basic optimizations that will do things like make iterators _much_ faster. Since fastbuild is how people iterate most of the time, this seems like a sensible default value. --- rust/toolchain.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/toolchain.bzl b/rust/toolchain.bzl index 834382ecf3..b9b02cf639 100644 --- a/rust/toolchain.bzl +++ b/rust/toolchain.bzl @@ -342,7 +342,7 @@ rust_toolchain = rule( doc = "Rustc optimization levels.", default = { "dbg": "0", - "fastbuild": "0", + "fastbuild": "1", "opt": "3", }, ), From d9bc1bbbdc68d8ec6ee638c85d4bf3a3fbbdde9b Mon Sep 17 00:00:00 2001 From: Augie Fackler Date: Wed, 12 Jan 2022 16:48:34 -0500 Subject: [PATCH 2/2] Regenerate documentation --- docs/flatten.md | 2 +- docs/rust_repositories.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/flatten.md b/docs/flatten.md index 08903691e4..525991d413 100644 --- a/docs/flatten.md +++ b/docs/flatten.md @@ -1167,7 +1167,7 @@ See @rules_rust//rust:repositories.bzl for examples of defining the @rust_cpuX r | default_edition | The edition to use for rust_* rules that don't specify an edition. | String | optional | "2018" | | dylib_ext | The extension for dynamic libraries created from rustc. | String | required | | | exec_triple | The platform triple for the toolchains execution environment. For more details see: https://docs.bazel.build/versions/master/skylark/rules.html#configurations | String | optional | "" | -| opt_level | Rustc optimization levels. | Dictionary: String -> String | optional | {"dbg": "0", "fastbuild": "0", "opt": "3"} | +| opt_level | Rustc optimization levels. | Dictionary: String -> String | optional | {"dbg": "0", "fastbuild": "1", "opt": "3"} | | os | The operating system for the current toolchain | String | required | | | rust_doc | The location of the rustdoc binary. Can be a direct source or a filegroup containing one item. | Label | optional | None | | rust_lib | The rust standard library. | Label | optional | None | diff --git a/docs/rust_repositories.md b/docs/rust_repositories.md index b7374ee4b5..50cc8c6d8e 100644 --- a/docs/rust_repositories.md +++ b/docs/rust_repositories.md @@ -93,7 +93,7 @@ See @rules_rust//rust:repositories.bzl for examples of defining the @rust_cpuX r | default_edition | The edition to use for rust_* rules that don't specify an edition. | String | optional | "2018" | | dylib_ext | The extension for dynamic libraries created from rustc. | String | required | | | exec_triple | The platform triple for the toolchains execution environment. For more details see: https://docs.bazel.build/versions/master/skylark/rules.html#configurations | String | optional | "" | -| opt_level | Rustc optimization levels. | Dictionary: String -> String | optional | {"dbg": "0", "fastbuild": "0", "opt": "3"} | +| opt_level | Rustc optimization levels. | Dictionary: String -> String | optional | {"dbg": "0", "fastbuild": "1", "opt": "3"} | | os | The operating system for the current toolchain | String | required | | | rust_doc | The location of the rustdoc binary. Can be a direct source or a filegroup containing one item. | Label | optional | None | | rust_lib | The rust standard library. | Label | optional | None |