From 2586cedc4affff0d23c5b8d53fbcf2c8f7e7d267 Mon Sep 17 00:00:00 2001 From: zakrad <49591476+zakrad@users.noreply.github.com> Date: Sat, 8 Aug 2026 23:41:55 +0330 Subject: [PATCH] Add regression test for save-temps ICE on incremental recompile --- tests/incremental/save-temps-66367.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/incremental/save-temps-66367.rs diff --git a/tests/incremental/save-temps-66367.rs b/tests/incremental/save-temps-66367.rs new file mode 100644 index 0000000000000..e5568f2968bba --- /dev/null +++ b/tests/incremental/save-temps-66367.rs @@ -0,0 +1,18 @@ +//! Regression test for . +//! +//! Adding `-C save-temps` to a follow-up incremental compile used to ICE: the codegen unit was +//! copied from the incremental cache, and the copy-from-cache path asserted that no bytecode was +//! wanted. `-C save-temps` wants it, so the assertion fired. + +//@ revisions: bpass1 bpass2 +//@ compile-flags: -Z query-dep-graph --crate-type=lib +//@[bpass2] compile-flags: -C save-temps + +#![feature(rustc_attrs)] +// `-C save-temps` is not part of the incremental command line hash, so the codegen unit is still +// reused in `bpass2` -- which is the path that used to ICE. +#![rustc_partition_reused(module = "save_temps_66367", cfg = "bpass2")] + +pub fn f() -> u32 { + 1 +}