From 5f1fdab4f819433c081603358190b7f64449ff92 Mon Sep 17 00:00:00 2001
From: LN Liberda <lauren@selfisekai.rocks>
Date: Sat, 4 Apr 2026 20:49:57 +0200
Subject: [PATCH] Use rust_sysroot instead of hardcoding
 //third_party/rust-toolchain

Bug: 491242305
---
 build/config/rust.gni      | 4 ++--
 build/rust/cargo_crate.gni | 4 ++--
 build/rust/std/BUILD.gn    | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/build/config/rust.gni b/build/config/rust.gni
index af3dfac4574f9..82fa215ea75d9 100644
--- a/build/config/rust.gni
+++ b/build/config/rust.gni
@@ -433,7 +433,7 @@ rustc_wrapper_inputs = [
 ]
 
 if (host_os == "win") {
-  rustc_wrapper_inputs += [ "//third_party/rust-toolchain/bin/rustc.exe" ]
+  rustc_wrapper_inputs += [ "$rust_sysroot/bin/rustc.exe" ]
 } else {
-  rustc_wrapper_inputs += [ "//third_party/rust-toolchain/bin/rustc" ]
+  rustc_wrapper_inputs += [ "$rust_sysroot/bin/rustc" ]
 }
diff --git a/build/rust/cargo_crate.gni b/build/rust/cargo_crate.gni
index 4b07ea1312ebc..2b78953c17825 100644
--- a/build/rust/cargo_crate.gni
+++ b/build/rust/cargo_crate.gni
@@ -464,9 +464,9 @@ template("cargo_crate") {
       ]
 
       if (host_os == "win") {
-        inputs += [ "//third_party/rust-toolchain/bin/rustc.exe" ]
+        inputs += [ "$rust_sysroot/bin/rustc.exe" ]
       } else {
-        inputs += [ "//third_party/rust-toolchain/bin/rustc" ]
+        inputs += [ "$rust_sysroot/bin/rustc" ]
       }
 
       build_script_target = ":${_build_script_name}($rust_macro_toolchain)"
diff --git a/build/rust/std/BUILD.gn b/build/rust/std/BUILD.gn
index 105a1d52a1682..88ed50182a604 100644
--- a/build/rust/std/BUILD.gn
+++ b/build/rust/std/BUILD.gn
@@ -269,9 +269,9 @@ if (toolchain_has_rust) {
       out_depfile = rebase_path(depfile, root_build_dir)
 
       if (host_os == "win") {
-        inputs = [ "//third_party/rust-toolchain/bin/rustc.exe" ]
+        inputs = [ "$rust_sysroot/bin/rustc.exe" ]
       } else {
-        inputs = [ "//third_party/rust-toolchain/bin/rustc" ]
+        inputs = [ "$rust_sysroot/bin/rustc" ]
       }
 
       # For the rustc sysroot we must include even the rlibs we don't pass to
