fix: target-pointer-width must be an integer in target spec JSON#33
fix: target-pointer-width must be an integer in target spec JSON#33zouguangxian merged 3 commits intoLayerZero-Labs:mainfrom
Conversation
PR SummaryMedium Risk Overview Bumps the pinned toolchain to Written by Cursor Bugbot for commit 288556a. This will update automatically on new commits. Configure here. |
rustc 1.91 (rust-lang/rust#144443) changed target-pointer-width in custom target JSON from a string to an integer. Bump the pinned toolchain to 1.94 to pick up that requirement and fix the template. zeroos-build now detects the active rustc minor version at runtime and emits the value as a quoted string for toolchains older than 1.91, keeping the tool portable. Also fix a direct function-item-to-integer cast in zeroos-arch-riscv that became a hard error under -D warnings once the function_casts_as_integer lint (rust-lang/rust#141470, stable in 1.93) was active.
| let pointer_width_json = match rustc_minor_version() { | ||
| Some(minor) if minor < 91 => format!("\"{}\"", arch_spec.pointer_width), | ||
| _ => arch_spec.pointer_width.to_string(), | ||
| }; |
There was a problem hiding this comment.
Version threshold for pointer-width format may be wrong
Low Severity
The code comment claims the target-pointer-width JSON type change happened in rustc 1.91, but the PR description states "rustc 1.94 tightened JSON schema validation and rejects the string form." The threshold minor < 91 may need to be minor < 94. If the change actually landed in 1.94, rustc versions 1.91–1.93 would receive the integer form when they still expect a string, producing invalid target JSON for anyone using those compiler versions.


rustc 1.94 tightened JSON schema validation and rejects the string form.