From 30ec676127975c597f846b6a47446a7b1d537b8f Mon Sep 17 00:00:00 2001 From: AI Agent Bot Date: Fri, 27 Feb 2026 03:47:56 -0600 Subject: [PATCH 1/2] fix: detect nightly rust-src updates in sysroot cache The sysroot freshness check only compared PSP overlay file mtimes against the cache stamp, missing cases where `rustup update nightly` installs a newer rust-src component. This caused stale sysroot builds with intrinsic mismatches when the nightly toolchain was updated. Now also checks the nightly's library/Cargo.lock mtime, triggering a sysroot rebuild when either the overlay or the toolchain changes. Co-Authored-By: Claude Opus 4.6 --- cargo-psp/src/main.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cargo-psp/src/main.rs b/cargo-psp/src/main.rs index a14d85d..7c501fb 100644 --- a/cargo-psp/src/main.rs +++ b/cargo-psp/src/main.rs @@ -286,13 +286,17 @@ fn prepare_psp_sysroot() -> Result<()> { // Check if we can skip re-creating the sysroot. let marker = dest.join(".psp-sysroot-stamp"); if marker.exists() { - // Re-create if any overlay file is newer than the marker. + // Re-create if overlay or rust-src is newer than the marker. let marker_time = fs::metadata(&marker) .and_then(|m| m.modified()) .unwrap_or(SystemTime::UNIX_EPOCH); let overlay_modified = newest_mtime(&overlay_src)?; - if overlay_modified <= marker_time { + let rust_src_modified = fs::metadata(rust_src.join("library/Cargo.lock")) + .and_then(|m| m.modified()) + .unwrap_or(SystemTime::UNIX_EPOCH); + + if overlay_modified <= marker_time && rust_src_modified <= marker_time { eprintln!("[NOTE]: PSP sysroot is up-to-date, skipping preparation."); return Ok(()); } From ad4e27604403ad609506c96cc7bd20557beacd98 Mon Sep 17 00:00:00 2001 From: AI Review Agent Date: Fri, 27 Feb 2026 03:57:06 -0600 Subject: [PATCH 2/2] fix: force sysroot rebuild when rust-src metadata is unreadable Default to SystemTime::now() instead of UNIX_EPOCH when library/Cargo.lock metadata fails, ensuring the sysroot is rebuilt rather than silently treated as up-to-date. Co-Authored-By: Claude Opus 4.6 --- cargo-psp/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cargo-psp/src/main.rs b/cargo-psp/src/main.rs index 7c501fb..608db58 100644 --- a/cargo-psp/src/main.rs +++ b/cargo-psp/src/main.rs @@ -294,7 +294,7 @@ fn prepare_psp_sysroot() -> Result<()> { let overlay_modified = newest_mtime(&overlay_src)?; let rust_src_modified = fs::metadata(rust_src.join("library/Cargo.lock")) .and_then(|m| m.modified()) - .unwrap_or(SystemTime::UNIX_EPOCH); + .unwrap_or_else(|_| SystemTime::now()); if overlay_modified <= marker_time && rust_src_modified <= marker_time { eprintln!("[NOTE]: PSP sysroot is up-to-date, skipping preparation.");