Skip to contentSkip to conversation

rust: support Rust >= 1.91.0 target spec

PATCH In review Miguel Ojeda 2 participants 2 messages Aug 29, 2025 – Aug 31, 2025 Rust

lore
Share & tools
lore

Miguel Ojeda

author maintainer
#0 lore raw

PATCH 1/1 rust: support Rust >= 1.91.0 target spec

Starting with Rust 1.91.0 (expected 2025-10-30), the target spec format has changed the type of the target-pointer-width key from string to integer [1].

Thus conditionally use one or the other depending on the version.

---
Conditional to the PR getting merged.

 scripts/generate_rust_target.rs | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
scripts/generate_rust_target.rs +10 -2
index 39c82908ff3a..38b3416bb979 100644
@@ -225,7 +225,11 @@ fn main() {
         ts.push("features", features);
         ts.push("llvm-target", "x86_64-linux-gnu");
         ts.push("supported-sanitizers", ["kcfi", "kernel-address"]);
-        ts.push("target-pointer-width", "64");
+        if cfg.rustc_version_atleast(1, 91, 0) {
+            ts.push("target-pointer-width", 64);
+        } else {
+            ts.push("target-pointer-width", "64");
+        }
     } else if cfg.has("X86_32") {
         // This only works on UML, as i386 otherwise needs regparm support in rustc
         if !cfg.has("UML") {
@@ -245,7 +249,11 @@ fn main() {
         }
         ts.push("features", features);
         ts.push("llvm-target", "i386-unknown-linux-gnu");
-        ts.push("target-pointer-width", "32");
+        if cfg.rustc_version_atleast(1, 91, 0) {
+            ts.push("target-pointer-width", 32);
+        } else {
+            ts.push("target-pointer-width", "32");
+        }
     } else if cfg.has("LOONGARCH") {
         panic!("loongarch uses the builtin rustc loongarch64-unknown-none-softfloat target");
     } else {

base-commit: 1b237f190eb3d36f52dffe07a40b5eb210280e00 --
2.51.0

#1 lore raw
Quoted 5 lines · Miguel Ojeda

Starting with Rust 1.91.0 (expected 2025-10-30), the target spec format has changed the type of the target-pointer-width key from string to integer [1].

Quoted 7 lines

Thus conditionally use one or the other depending on the version.

---
Conditional to the PR getting merged.

The PR landed, so applied to rust-fixes.

I may be able to take tags tomorrow, so those are welcome of course (thanks in advance!), although it is already getting tested in the Rust CI, so it should be pretty safe.

Cheers,
Miguel