chromium: fix build with rust 1.89.0

Co-authored-by: Emily <git@emilylange.de>
This commit is contained in:
Yureka
2025-08-19 20:03:47 +02:00
co-authored by Emily
parent 4f0917ea13
commit 6a7b45f0f7
2 changed files with 32 additions and 0 deletions
@@ -526,6 +526,24 @@ let
# preventing compilations of chromium with versions below their intended version, not about running the very
# exact version or even running a newer version.
./patches/chromium-136-nodejs-assert-minimal-version-instead-of-exact-match.patch
]
++ lib.optionals (chromiumVersionAtLeast "138") [
(fetchpatch {
# Unbreak building with Rust 1.89+ which introduced
# a new mismatched_lifetime_syntaxes lint.
# https://issues.chromium.org/issues/424424323
name = "chromium-138-rust-1.86-mismatched_lifetime_syntaxes.patch";
# https://chromium-review.googlesource.com/c/chromium/src/+/6658267
url = "https://chromium.googlesource.com/chromium/src/+/94a87ff38c51fd1a71980a5051d3553978391608^!?format=TEXT";
decode = "base64 -d";
includes = [ "build/rust/cargo_crate.gni" ];
hash = "sha256-xf1Jq5v3InXkiVH0uT7+h1HPwZse5MDcHKuJNjSLR6k=";
})
]
++ lib.optionals (!chromiumVersionAtLeast "138") [
# Rebased variant of the patch above for
# electron 35 (M134) and 36 (M136)
./patches/chromium-134-rust-1.86-mismatched_lifetime_syntaxes.patch
];
postPatch =
@@ -0,0 +1,14 @@
diff --git a/build/rust/cargo_crate.gni b/build/rust/cargo_crate.gni
index 8266c44cbd1dfb8a53797dbe911ea74c32ce070e..ec7d751f2d068151dfeb71aa1f6510483bebd95c 100644
--- a/build/rust/cargo_crate.gni
+++ b/build/rust/cargo_crate.gni
@@ -285,6 +285,9 @@ template("cargo_crate") {
}
rustenv = _rustenv
+ # TODO(crbug.com/424424323): Clean up and enable.
+ rustflags += [ "-Amismatched_lifetime_syntaxes" ]
+
if (!defined(build_native_rust_unit_tests)) {
build_native_rust_unit_tests = _crate_type != "proc-macro"
}