From 42de475d49ca2f836232f07777853336b126ded3 Mon Sep 17 00:00:00 2001
From: Funda Wang <fundawang@yeah.net>
Date: Tue, 25 Aug 2026 13:00:59 +0800
Subject: [PATCH] build: fall back to unknown vendor when detecting the rust
 host triplet

Distro toolchains report a distro-specific vendor in the configure host
triple (e.g. "pc" from config.guess, or "openEuler") that has no
matching rust target. Fall back to the generic "unknown" vendor so
that vendor-specific targets (e.g. the *-oe-linux-gnu targets added in
rust 1.98) don't break rust host triplet detection.

Co-Authored-By: AtomCode (deepseek-v4-flash) <noreply@atomgit.com>
---
 build/moz.configure/rust.configure | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/build/moz.configure/rust.configure b/build/moz.configure/rust.configure
index b92c26d..29e4c78 100644
--- a/build/moz.configure/rust.configure
+++ b/build/moz.configure/rust.configure
@@ -417,6 +417,15 @@ def detect_rustc_target(
         if len(narrowed) == 1:
             return narrowed[0].rust_target
 
+        # Distro toolchains report a distro-specific vendor in the configure
+        # host triple (e.g. "pc" from config.guess, or "openEuler") that has no
+        # matching rust target. Fall back to the generic "unknown" vendor so
+        # that vendor-specific targets (e.g. the *-oe-linux-gnu targets added
+        # in rust 1.98) don't break rust host triplet detection.
+        narrowed = [c for c in candidates if c.target.vendor == "unknown"]
+        if len(narrowed) == 1:
+            return narrowed[0].rust_target
+
         return None
 
     rustc_target = find_candidate(candidates)