rust-lang / rust-lang/rust

[ICE]: "warning: error copying object file" damages incremental build cache, induces ICE in subsequent builds unless pruned

Open
#157,674 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-incr-comp C-bug I-ICE O-windows T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

$ rustc --version --verbose
rustc 1.96.0 (ac68faa20 2026-05-25)
binary: rustc
commit-hash: ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96
commit-date: 2026-05-25
host: x86_64-pc-windows-gnu
release: 1.96.0
LLVM version: 22.1.2

Starting with target/debug/incremental/cargo* deleted:

$ cargo build
warning: `D:\Users\nabijaczleweli\.cargo\config` is deprecated in favor of `config.toml`
  |
  = help: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
   Compiling cargo-update v20.0.0 (P:\Rust\cargo-update)
warning: error copying object file `P:\Rust\cargo-update\target\debug\deps\libcargo_update-e847dae16ed1dcdc.rmeta` to incremental directory as `\\?\V:\Rust-target\debug\incremental\cargo_update-3qbqkuu5iqvls\s-hjbhiioeg6-0au3i45-working\metadata.rmeta`: Access is denied. (os error 5)

warning: `cargo-update` (lib) generated 1 warning
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 6.13s

This build succeeds and produces target/debug/cargo-install-update.exe

With nothing changed:

$ cargo build
warning: `D:\Users\nabijaczleweli\.cargo\config` is deprecated in favor of `config.toml`
  |
  = help: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
warning: error copying object file `P:\Rust\cargo-update\target\debug\deps\libcargo_update-e847dae16ed1dcdc.rmeta` to incremental directory as `\\?\V:\Rust-target\debug\incremental\cargo_update-3qbqkuu5iqvls\s-hjbhiioeg6-0au3i45-working\metadata.rmeta`: Access is denied. (os error 5)

warning: `cargo-update` (lib) generated 1 warning
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.43s

(warning appears but doesn't do anything)

After changing main.rs:

$ cargo build
warning: `D:\Users\nabijaczleweli\.cargo\config` is deprecated in favor of `config.toml`
  |
  = help: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
   Compiling cargo-update v20.0.0 (P:\Rust\cargo-update)

thread 'rustc' (5872) panicked at /rustc-dev/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/compiler\rustc_metadata\src\rmeta\encoder.rs:2448:51:
no entry found for key
stack backtrace:
   0:     0x7ffe89257dbf - std[103871820a823c36]::backtrace_rs::backtrace::win64::trace
                               at /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library\std\src\..\..\backtrace\src\backtrace/win64.rs:85:14
   1:     0x7ffe89257dbf - std[103871820a823c36]::backtrace_rs::backtrace::trace_unsynchronized::<std[103871820a823c36]::sys::backtrace::_print_fmt::{closure#1}>
                               at /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library\std\src\..\..\backtrace\src\backtrace/mod.rs:66:14
   2:     0x7ffe89257dbf - std[103871820a823c36]::sys::backtrace::_print_fmt
                               at /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library\std\src\sys/backtrace.rs:74:9
   3:     0x7ffe89257dbf - <<std[103871820a823c36]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[7eb90ffabe67d87f]::fmt::Display>::fmt
                               at /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library\std\src\sys/backtrace.rs:44:26
   4:     0x7ffe89297671 - <core[7eb90ffabe67d87f]::fmt::rt::Argument>::fmt
                               at /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library\core\src\fmt/rt.rs:152:76
   5:     0x7ffe89297671 - core[7eb90ffabe67d87f]::fmt::write
   6:     0x7ffe89267ff2 - std[103871820a823c36]::io::default_write_fmt::<std[103871820a823c36]::sys::stdio::windows::Stderr>
                               at /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library\std\src\io/mod.rs:621:11
   7:     0x7ffe89267ff2 - <std[103871820a823c36]::sys::stdio::windows::Stderr as std[103871820a823c36]::io::Write>::write_fmt
                               at /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library\std\src\io/mod.rs:1976:13
   8:     0x7ffe892272b1 - <std[103871820a823c36]::sys::backtrace::BacktraceLock>::print
                               at /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library\std\src\sys/backtrace.rs:47:9
   9:     0x7ffe892272b1 - std[103871820a823c36]::panicking::default_hook::{closure#0}
                               at /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library\std\src/panicking.rs:292:27
  10:     0x7ffe89247e8b - std[103871820a823c36]::panicking::default_hook
                               at /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library\std\src/panicking.rs:319:9
  11:     0x7ffe5229cbba - std[103871820a823c36]::panicking::update_hook::<alloc[83eb0dd09eb55b1c]::boxed::Box<rustc_driver_impl[e175a339f588150f]::install_ice_hook::{closure#1}>>::{closure#0}
  12:     0x7ffe89248209 - <alloc[83eb0dd09eb55b1c]::boxed::Box<dyn for<'a, 'b> core[7eb90ffabe67d87f]::ops::function::Fn<(&'a std[103871820a823c36]::panic::PanicHookInfo<'b>,), Output = ()> + core[7eb90ffabe67d87f]::marker::Sync + core[7eb90ffabe67d87f]::marker::Send> as core[7eb90ffabe67d87f]::ops::function::Fn<(&std[103871820a823c36]::panic::PanicHookInfo,)>>::call
                               at /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library\alloc\src/boxed.rs:2263:9
  13:     0x7ffe89248209 - std[103871820a823c36]::panicking::panic_with_hook
                               at /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library\std\src/panicking.rs:833:13
  14:     0x7ffe8922738d - std[103871820a823c36]::panicking::panic_handler::{closure#0}
                               at /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library\std\src/panicking.rs:698:13
  15:     0x7ffe8921acaf - std[103871820a823c36]::sys::backtrace::__rust_end_short_backtrace::<std[103871820a823c36]::panicking::panic_handler::{closure#0}, !>
                               at /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library\std\src\sys/backtrace.rs:182:18
  16:     0x7ffe8922807e - __rustc[8068f81614cfe5c]::rust_begin_unwind
                               at /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library\std\src/panicking.rs:689:5
  17:     0x7ffe8929814d - core[7eb90ffabe67d87f]::panicking::panic_fmt
                               at /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library\core\src/panicking.rs:80:14
  18:     0x7ffe89297d85 - core[7eb90ffabe67d87f]::panicking::panic_display::<&str>
                               at /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library\core\src/panicking.rs:259:5
  19:     0x7ffe89297d85 - core[7eb90ffabe67d87f]::option::expect_failed
                               at /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library\core\src/option.rs:2260:5
  20:     0x7ffe5514d184 - rustc_metadata[354cdd2b2ecdc417]::rmeta::encoder::encode_metadata
  21:     0x7ffe5522505d - rustc_metadata[354cdd2b2ecdc417]::fs::encode_and_write_metadata
  22:     0x7ffe5254a02c - rustc_interface[45e64ae5edd9cc5c]::passes::start_codegen
  23:     0x7ffe524eb686 - <rustc_interface[45e64ae5edd9cc5c]::queries::Linker>::codegen_and_build_linker
  24:     0x7ffe5226dae7 - <std[103871820a823c36]::thread::local::LocalKey<core[7eb90ffabe67d87f]::cell::Cell<*const ()>>>::with::<rustc_middle[e0d897412b502ba6]::ty::context::tls::enter_context<<rustc_middle[e0d897412b502ba6]::ty::context::GlobalCtxt>::enter<rustc_interface[45e64ae5edd9cc5c]::passes::create_and_enter_global_ctxt<core[7eb90ffabe67d87f]::option::Option<rustc_interface[45e64ae5edd9cc5c]::queries::Linker>, rustc_driver_impl[e175a339f588150f]::run_compiler::{closure#0}::{closure#2}>::{closure#2}, core[7eb90ffabe67d87f]::option::Option<rustc_interface[45e64ae5edd9cc5c]::queries::Linker>>::{closure#1}, core[7eb90ffabe67d87f]::option::Option<rustc_interface[45e64ae5edd9cc5c]::queries::Linker>>::{closure#0}, core[7eb90ffabe67d87f]::option::Option<rustc_interface[45e64ae5edd9cc5c]::queries::Linker>>
  25:     0x7ffe522238f5 - <rustc_middle[e0d897412b502ba6]::ty::context::TyCtxt>::create_global_ctxt::<core[7eb90ffabe67d87f]::option::Option<rustc_interface[45e64ae5edd9cc5c]::queries::Linker>, rustc_interface[45e64ae5edd9cc5c]::passes::create_and_enter_global_ctxt<core[7eb90ffabe67d87f]::option::Option<rustc_interface[45e64ae5edd9cc5c]::queries::Linker>, rustc_driver_impl[e175a339f588150f]::run_compiler::{closure#0}::{closure#2}>::{closure#2}>
  26:     0x7ffe52239b30 - rustc_interface[45e64ae5edd9cc5c]::passes::create_and_enter_global_ctxt::<core[7eb90ffabe67d87f]::option::Option<rustc_interface[45e64ae5edd9cc5c]::queries::Linker>, rustc_driver_impl[e175a339f588150f]::run_compiler::{closure#0}::{closure#2}>
  27:     0x7ffe5227bd82 - rustc_span[f226af2a89e9fbaf]::create_session_globals_then::<(), rustc_interface[45e64ae5edd9cc5c]::util::run_in_thread_with_globals<rustc_interface[45e64ae5edd9cc5c]::util::run_in_thread_pool_with_globals<rustc_interface[45e64ae5edd9cc5c]::interface::run_compiler<(), rustc_driver_impl[e175a339f588150f]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}>
  28:     0x7ffe522b7194 - std[103871820a823c36]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[45e64ae5edd9cc5c]::util::run_in_thread_with_globals<rustc_interface[45e64ae5edd9cc5c]::util::run_in_thread_pool_with_globals<rustc_interface[45e64ae5edd9cc5c]::interface::run_compiler<(), rustc_driver_impl[e175a339f588150f]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  29:     0x7ffe5229d23f - <std[103871820a823c36]::thread::lifecycle::spawn_unchecked<rustc_interface[45e64ae5edd9cc5c]::util::run_in_thread_with_globals<rustc_interface[45e64ae5edd9cc5c]::util::run_in_thread_pool_with_globals<rustc_interface[45e64ae5edd9cc5c]::interface::run_compiler<(), rustc_driver_impl[e175a339f588150f]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[7eb90ffabe67d87f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  30:     0x7ffe8925521d - <alloc[83eb0dd09eb55b1c]::boxed::Box<dyn core[7eb90ffabe67d87f]::ops::function::FnOnce<(), Output = ()> + core[7eb90ffabe67d87f]::marker::Send> as core[7eb90ffabe67d87f]::ops::function::FnOnce<()>>::call_once
                               at /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library\alloc\src/boxed.rs:2249:9
  31:     0x7ffe8925521d - <std[103871820a823c36]::sys::thread::windows::Thread>::new::thread_start
                               at /rustc/ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96/library\std\src\sys\thread/windows.rs:58:13
  32:     0x7ffef4348364 - <unknown>
  33:     0x7ffef44770d1 - <unknown>

error: the compiler unexpectedly panicked. This is a bug

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.96.0 (ac68faa20 2026-05-25) running on x86_64-pc-windows-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `cargo-update` (lib)

Caused by:
  process didn't exit successfully: `D:\Users\nabijaczleweli\.rustup\toolchains\stable-x86_64-pc-windows-gnu\bin\rustc.exe --crate-name cargo_update --edition=2015 src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg "feature=\"default\"" --check-cfg cfg(docsrs,test) --check-cfg "cfg(feature, values(\"default\", \"vendored-libcurl\", \"vendored-libgit2\", \"vendored-openssl\"))" -C metadata=1f77388395f59734 -C extra-filename=-e847dae16ed1dcdc --out-dir P:\Rust\cargo-update\target\debug\deps -C incremental=P:\Rust\cargo-update\target\debug\incremental -L dependency=P:\Rust\cargo-update\target\debug\deps --extern chrono=P:\Rust\cargo-update\target\debug\deps\libchrono-7bfdae7149d302f2.rmeta --extern clap=P:\Rust\cargo-update\target\debug\deps\libclap-5ea6de2e4b806320.rmeta --extern curl=P:\Rust\cargo-update\target\debug\deps\libcurl-9391648b621c1e13.rmeta --extern git2=P:\Rust\cargo-update\target\debug\deps\libgit2-fc3c39bc7f8051f0.rmeta --extern hex=P:\Rust\cargo-update\target\debug\deps\libhex-92af3453014f89e2.rmeta --extern home=P:\Rust\cargo-update\target\debug\deps\libhome-9e6631f89e9dc78e.rmeta --extern jobserver=P:\Rust\cargo-update\target\debug\deps\libjobserver-fe357b099025761e.rmeta --extern semver=P:\Rust\cargo-update\target\debug\deps\libsemver-52c272bbb3aa4bbc.rmeta --extern serde=P:\Rust\cargo-update\target\debug\deps\libserde-1c1a339ebe90e995.rmeta --extern serde_derive=P:\Rust\cargo-update\target\debug\deps\serde_derive-fd023561b10fc953.dll --extern serde_json=P:\Rust\cargo-update\target\debug\deps\libserde_json-175174dd77d4d2ba.rmeta --extern tabwriter=P:\Rust\cargo-update\target\debug\deps\libtabwriter-d26aec6f250a52b9.rmeta --extern toml=P:\Rust\cargo-update\target\debug\deps\libtoml-f2fdd64f8e314611.rmeta --extern url=P:\Rust\cargo-update\target\debug\deps\liburl-122e69c1d2370100.rmeta --extern whoami=P:\Rust\cargo-update\target\debug\deps\libwhoami-815392bd3e97c53c.rmeta --extern windows=P:\Rust\cargo-update\target\debug\deps\libwindows-0e86e46bc1e7bcb7.rmeta -L native=P:\Rust\cargo-update\target\debug\build\curl-sys-44d0f883e8c12bab\out\build -L native=P:\Rust\cargo-update\target\debug\build\libnghttp2-sys-590a71d4580b214f\out\i\lib -L native=P:\Rust\cargo-update\target\debug\build\libz-sys-b08937bd42dba9f7\out\lib -L native=P:\Rust\cargo-update\target\debug\build\libz-sys-b08937bd42dba9f7\out\lib -L native=P:\Rust\cargo-update\target\debug\build\libssh2-sys-58d8342fd041f68c\out\build -L native=D:\Users\nabijaczleweli\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\windows_x86_64_gnu-0.53.0\lib -L native=/mingw64/lib -L native=D:\Users\nabijaczleweli\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\windows_x86_64_gnu-0.52.6\lib -L native=/mingw64/lib` (exit code: 101)

The layout of my target directory may be of interest:
P:\Rust\cargo-update\target JUNCTION p:\Rust\target
P:\Rust\target JUNCTION s:\Rust-target
S:\Rust-target JUNCTION v:\Rust-target
v:\Rust-target is a real directory, no internal links

This smells to me like some sort of EXDEV?

The source file (P:\Rust\cargo-update\target\debug\deps\libcargo_update-e847dae16ed1dcdc.rmeta) is still real afterward, the directory containing the target (\?\V:\Rust-target\debug\incremental\cargo_update-3qbqkuu5iqvls\s-hjbhvs6u46-0ouqlsm-working\metadata.rmeta) isn't, but the file does exist in the only similarly-named new directory (V:\Rust-target\debug\incremental\cargo_update-3qbqkuu5iqvls\s-hjbhvs6u46-0ouqlsm-dgr1uuofn17hs3fti5y5oob2k\metadata.rmeta) with the same contents.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the incremental-compilation reproduction using cargo build on x86_64-pc-windows-gnu, then inspect rustc_metadata/src/rmeta/encoder.rs at the reported line 2448:51. Trace how the failed object-file copy leaves the incremental directory before the subsequent metadata-encoding ICE. Done means the copy failure no longer damages later builds or causes the compiler panic.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.