Skip to content

Commit f1b0fc2

Browse files
committed
Update the Rust nightly version
This is needed to support the latest version of the virtio-drivers crate, which in turn is needed to be able to implement a custom virtio-console driver. This required some additional changes: - The `array_chunks` unstable feature is no longer supported - Switched to using `chunks` - The `assert_matches` unstable feature has been stabilized - The `naked_functions` unstable feature has been stabilized - `compiler_builtins` moved from being a vendored crate to main crate - `experimental_use_allocator_libraries_with_mangled_symbols` is needed for FFI - Latest version of `rules_rust` is also required - Type coercion for try blocks seems to have changed - Had to add additional `map_err`s - Formatting of some pointers changed so had to change one stage0 kernel command-line argument - `slice::Fill` now also uses compiler intrinsics, which broke the Restricted Kernel Wrapper, so had to replace it with a manual for loop - Many clippy issues had to be fixed - Including some in oak_private_memory NOKEYCHECK: test key only. BUG: 464483492 Change-Id: Ib2e3357df2ba916fb553ccad18df2a8a6a6a6964
1 parent d1c3b75 commit f1b0fc2

88 files changed

Lines changed: 1577 additions & 1578 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bazelrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ common --@rules_rust//rust/settings:toolchain_generated_sysroot=True
4545
# control. (See: https://github.com/bazelbuild/rules_rust/pull/3120)
4646
common --@rules_rust//rust/settings:lto=manual
4747

48+
# Newer versions of rustc performs internal symbol mangling.
49+
# We need to set this flag to link to allocator libraries in FFI code.
50+
# See https://github.com/bazelbuild/rules_rust/pull/3403
51+
common --@rules_rust//rust/settings:experimental_use_allocator_libraries_with_mangled_symbols
52+
4853
# Required to enable building the openssl Rust crate. See
4954
# https://nixos.wiki/wiki/Rust#Building_Rust_crates_that_require_external_system_libraries
5055
# for more information.

MODULE.bazel

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,8 @@ bazel_dep(name = "rules_java", version = "8.14.0")
282282
##### Rust Toolchain Setup #####
283283

284284
bazel_dep(name = "rules_shell", version = "0.6.1")
285-
bazel_dep(name = "rules_rust", version = "0.68.1")
286-
bazel_dep(name = "rules_rust_wasm_bindgen", version = "0.68.1")
285+
bazel_dep(name = "rules_rust", version = "0.70.0")
286+
bazel_dep(name = "rules_rust_wasm_bindgen", version = "0.70.0")
287287

288288
# All Rust toolchains are configured in //bazel/rust:extensions.bzl
289289
# which reads the version and SHA256s from //bazel/rust:defs.bzl
@@ -965,9 +965,7 @@ crate.spec(
965965
features = ["alloc_ref"],
966966
package = "linked_list_allocator",
967967
repositories = ALL_REPOSITORIES,
968-
# We need to update to a more recent rust nightly to upgrade this crate.
969-
# See https://github.com/rust-osdev/linked-list-allocator/pull/90
970-
version = "=0.10.5",
968+
version = "0.10.6",
971969
)
972970
crate.annotation(
973971
crate = "linked_list_allocator",

MODULE.bazel.lock

Lines changed: 555 additions & 491 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bazel/rust/defs.bzl

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This should be kept in sync with the value in flake.nix
44
# Chosen to match the current internal Rust nightly (go/current-rust-nightly)
55
# You'll likely need to update the sha256 hashes below as well.
6-
RUST_NIGHTLY_DATE = "2025-03-01"
6+
RUST_NIGHTLY_DATE = "2026-04-11"
77

88
RUST_NIGHTLY_VERSION = "nightly/" + RUST_NIGHTLY_DATE
99

@@ -39,35 +39,34 @@ SUPPORTED_RUST_COMPONENTS = [
3939
# We have some backup checks to try to help make sure all keys are present.
4040
RUST_SHA256S = {
4141
# Linux x86_64 Host
42-
"2025-03-01/cargo-nightly-x86_64-unknown-linux-gnu.tar.xz": "9dfde3b932a240ed7adbef95f9d1437681137c6e0b71ad95b2579cada0623e26",
43-
"2025-03-01/clippy-nightly-x86_64-unknown-linux-gnu.tar.xz": "f5cb5053fee14e60bac386caf37a3542f6ac34fd73076e9329e4aac2e6caf640",
44-
"2025-03-01/llvm-tools-nightly-x86_64-unknown-linux-gnu.tar.xz": "22ed657fa3092f172cda7ff2c68d560f03e312d0b0d643356d89f4254e858c92",
45-
"2025-03-01/rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz": "bbfecef0f783ff9fde8485c3739ca71f549e44d9633e58ed5086cf7a09da3fd9",
46-
"2025-03-01/rustc-nightly-x86_64-unknown-linux-gnu.tar.xz": "089b01d390bf42e40b2f1eb960033bba83b54c5b70c2d457e0a31ecb99e87f11",
47-
"2025-03-01/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz": "4f6b4fdcf919e8358b4001d220e2a62208765308dcc8504051c2d3c03efe7fce",
42+
"2026-04-11/cargo-nightly-x86_64-unknown-linux-gnu.tar.xz": "b4c95336c94a70b33f5b7b471315c8b4ab0a10c5c936554d73101d8e9dd76444",
43+
"2026-04-11/clippy-nightly-x86_64-unknown-linux-gnu.tar.xz": "658854d7dd8c4ed312ed703768578fed74509775a6053f3552663f4074c8c03f",
44+
"2026-04-11/llvm-tools-nightly-x86_64-unknown-linux-gnu.tar.xz": "133a0d5c074964af93661ba86d1200b4363c16ab1cbcdb57d56818610a6d2ad7",
45+
"2026-04-11/rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz": "e438f81cb8340e1093d7e799c6e742eb76779b360146d178b7104b4f7a89b3e1",
46+
"2026-04-11/rustc-nightly-x86_64-unknown-linux-gnu.tar.xz": "6c32f2c2bf33b2d45a5f969f5d30c764f3c5c35179af65f7dae3448779bdfa89",
47+
"2026-04-11/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz": "f64247b36ca1de77472e194027c1d28a0b8fe1fa27c7fd25dd0f8715ef051f7a",
4848
# macOS ARM64 Host
49-
"2025-03-01/cargo-nightly-aarch64-apple-darwin.tar.xz": "a69239a4bd94c6b722a8236a24ee06a61da33ffca72fcb06eb75a64435a0952c",
50-
"2025-03-01/clippy-nightly-aarch64-apple-darwin.tar.xz": "bb1a3f7683520e93ec083359cde495057a207ff231624d0d7ef802ecb5c18c07",
51-
"2025-03-01/llvm-tools-nightly-aarch64-apple-darwin.tar.xz": "573fc4aa45b92b00a69f5b5ba80cc1b68b4c78ec2dad5af1311607ba34b3f5cb",
52-
"2025-03-01/rust-std-nightly-aarch64-apple-darwin.tar.xz": "a18eee3a5df3966f11f719f6acadb7a7cc6e8cba590466ec418c7715e605cd52",
53-
"2025-03-01/rustc-nightly-aarch64-apple-darwin.tar.xz": "a0b4dcdb53e8aa7604ce25a673e3429e7b66a6238f8cc798bf00d37d127e02c3",
54-
"2025-03-01/rustfmt-nightly-aarch64-apple-darwin.tar.xz": "03569e9884f02a97fee511868f89573562f7c2742b7afd1acfba99fea0b5ffd0",
49+
"2026-04-11/cargo-nightly-aarch64-apple-darwin.tar.xz": "b52f3de5fbbfc96912798f7d41917cd8bb6e7d37b1445e8aab84aee55a64e6c0",
50+
"2026-04-11/clippy-nightly-aarch64-apple-darwin.tar.xz": "556b6626673ad8264f0d9c3a4e94af7a1be0e151907a759c03b566e53bb08394",
51+
"2026-04-11/llvm-tools-nightly-aarch64-apple-darwin.tar.xz": "9c0af22e6ce87c8ff8e27ce72d398a890197123cdd1f23eda144f88badb3ed15",
52+
"2026-04-11/rust-std-nightly-aarch64-apple-darwin.tar.xz": "03b79ff37e48d7ef916ce453fc4f2d0f7e150552b9e02cd1b28377f3a4af1bed",
53+
"2026-04-11/rustc-nightly-aarch64-apple-darwin.tar.xz": "07c67d50eab56d5e63329967bd25387beb5a53824583fdbe910ad1b41868499f",
54+
"2026-04-11/rustfmt-nightly-aarch64-apple-darwin.tar.xz": "7a637a2a8757275cfec71c47d41d3f02480fefe31e029e17cf77c25162212afa",
5555
# Target-only triples
56-
"2025-03-01/rust-std-nightly-wasm32-unknown-unknown.tar.xz": "8ca5b9a0de5a3d72b8866638e0255adfdcd5445a1a650a895c3814d41b956c09",
57-
"2025-03-01/rust-std-nightly-wasm32-wasip2.tar.xz": "83d6c2b3c4ad1257c5ce2ff0c0821011d83ef2a31157e5ff76f2544c89877af5",
58-
"2025-03-01/rust-std-nightly-x86_64-unknown-none.tar.xz": "77ee6bffcfd1383903eb5ea095a2a06ae58b8c30312deda75b562402f56dadb0",
56+
"2026-04-11/rust-std-nightly-wasm32-unknown-unknown.tar.xz": "72206748af37a2c9938fd9bb27d56b32dc6d92c3ad443dda5ee99351a4d59a94",
57+
"2026-04-11/rust-std-nightly-wasm32-wasip2.tar.xz": "31f33c2374620a7365f40d46528997cd43c80cc14a14662ef316febefb0305b3",
58+
"2026-04-11/rust-std-nightly-x86_64-unknown-none.tar.xz": "0b484e14e6a82f74062928210f7cba53470487265e52c6621b70dee0a024c3e2",
5959
}
6060

61-
STDLIBS_SHA256 = "4743b974292186c91f4daba45de20edfbc6aa293671953aca30168608e69609e"
61+
STDLIBS_SHA256 = "7a45b8e66cc4a451684ce551bc43d17c3915a74bffd1dd1f01f17ffff8b5349a"
6262

6363
# If updates change stdlib dependencies, you may need to update these. Hunt
6464
# around in your bazel cache's `$BAZEL_CACHE/external/stdlibs/vendor` path to see what's available.
6565
# Most likely you can just pick the latest one.
6666
STDLIBS_DEPS_VERSIONS = {
67-
"compiler_builtins": "0.1.148",
68-
"cfg-if": "1.0.0",
69-
"libc": "0.2.169",
70-
"rustc-demangle": "0.1.24",
67+
"cfg-if": "1.0.4",
68+
"libc": "0.2.184",
69+
"rustc-demangle": "0.1.27",
7170
}
7271

7372
RUST_EDITION = "2024"

bazel/rust/stdlibs.BUILD

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ rust_library(
3939
compile_data = glob(["library/alloc/src/**/*.md"]),
4040
crate_features = ["no_std"],
4141
crate_name = "alloc",
42-
edition = "2021",
42+
edition = "2024",
4343
rustc_env = {
4444
"RUSTC_BOOTSTRAP": "1",
4545
},
@@ -57,10 +57,10 @@ rust_library(
5757
name = "compiler_builtins",
5858
# There are multiple versions available in the nightly tarball, we choose the newest.
5959
srcs = glob([
60-
"vendor/compiler_builtins-" + STDLIBS_DEPS_VERSIONS["compiler_builtins"] + "/src/**/*.rs",
61-
"vendor/compiler_builtins-" + STDLIBS_DEPS_VERSIONS["compiler_builtins"] + "/libm/**/*.rs",
60+
"library/compiler-builtins/compiler-builtins/src/**/*.rs",
61+
"library/compiler-builtins/libm/**/*.rs",
6262
]),
63-
compile_data = glob(["vendor/compiler_builtins-0.1.123/src/**/*.md"]),
63+
compile_data = glob(["library/compiler-builtins/compiler-builtins/src/**/*.md"]),
6464
crate_features = [
6565
"compiler-builtins",
6666
"force-soft-floats",
@@ -70,7 +70,10 @@ rust_library(
7070
"unstable",
7171
],
7272
crate_name = "compiler_builtins",
73-
edition = "2021",
73+
# Explicit crate root is required because both libm/ and compiler-builtins/
74+
# contain a src/lib.rs, and rules_rust would otherwise pick the wrong one.
75+
crate_root = "library/compiler-builtins/compiler-builtins/src/lib.rs",
76+
edition = "2024",
7477
rustc_env = {
7578
"RUSTC_BOOTSTRAP": "1",
7679
},
@@ -98,7 +101,7 @@ rust_library(
98101
"no_std",
99102
],
100103
crate_name = "core",
101-
edition = "2021",
104+
edition = "2024",
102105
rustc_env = {
103106
"RUSTC_BOOTSTRAP": "1",
104107
},
@@ -121,6 +124,7 @@ rust_library(
121124
"no_std",
122125
],
123126
crate_name = "cfg_if",
127+
edition = "2024",
124128
rustc_env = {
125129
"RUSTC_BOOTSTRAP": "1",
126130
},
@@ -142,6 +146,7 @@ rust_library(
142146
"no_std",
143147
],
144148
crate_name = "panic_abort",
149+
edition = "2024",
145150
rustc_env = {
146151
"RUSTC_BOOTSTRAP": "1",
147152
},
@@ -170,7 +175,7 @@ rust_library(
170175
"align",
171176
],
172177
crate_name = "libc",
173-
edition = "2021",
178+
edition = "2024",
174179
rustc_env = {
175180
"RUSTC_BOOTSTRAP": "1",
176181
},
@@ -198,6 +203,7 @@ rust_library(
198203
"llvm-libunwind",
199204
],
200205
crate_name = "unwind",
206+
edition = "2024",
201207
rustc_env = {
202208
"RUSTC_BOOTSTRAP": "1",
203209
},
@@ -216,14 +222,15 @@ rust_library(
216222

217223
rust_library(
218224
name = "rustc_demangle",
219-
srcs = glob(["vendor/rustc-demangle-0.1.24/src/**/*.rs"]),
220-
compile_data = glob(["vendor/rustc-demangle-0.1.24/src/**/*.md"]),
225+
srcs = glob(["vendor/rustc-demangle-" + STDLIBS_DEPS_VERSIONS["rustc-demangle"] + "/src/**/*.rs"]),
226+
compile_data = glob(["vendor/rustc-demangle-" + STDLIBS_DEPS_VERSIONS["rustc-demangle"] + "/src/**/*.md"]),
221227
crate_features = [
222228
"core",
223229
"compiler_builtins",
224230
"no_std",
225231
],
226232
crate_name = "rustc_demangle",
233+
edition = "2024",
227234
rustc_env = {
228235
"RUSTC_BOOTSTRAP": "1",
229236
},
@@ -245,6 +252,7 @@ rust_library(
245252
"no_std",
246253
],
247254
crate_name = "panic_unwind",
255+
edition = "2024",
248256
rustc_env = {
249257
"RUSTC_BOOTSTRAP": "1",
250258
},

codelab/MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ bazel_dep(name = "protobuf", version = "30.0", repo_name = "com_google_protobuf"
1010
bazel_dep(name = "grpc", version = "1.72.0", repo_name = "com_github_grpc_grpc")
1111
bazel_dep(name = "grpc-java", version = "1.71.0", repo_name = "io_grpc_grpc_java")
1212
bazel_dep(name = "rules_shell", version = "0.6.1")
13-
bazel_dep(name = "rules_rust", version = "0.68.1")
13+
bazel_dep(name = "rules_rust", version = "0.70.0")
1414
bazel_dep(name = "toolchains_llvm", version = "1.6.0")
1515

1616
# Depend on Oak for shared toolchains and crates.

0 commit comments

Comments
 (0)