Skip to content

Toggling -Zno-embed-metadata doesn't invalidate build cache #16503

@bjorn3

Description

@bjorn3

Problem

Toggling -Zno-embed-metadata should cause everything to be rebuilt. Otherwise rustc will complain about missing rmeta files when recompiling a crate.

Steps

export RUSTUP_TOOLCHAIN=nightly
cargo new foo
cd foo
cargo add serde
echo "use serde;" >> src/main.rs
cargo -Zno-embed-metadata build
cargo clean -p foo
cargo build
   Compiling foo v0.1.0 (/tmp/foo)
error: only metadata stub found for `rlib` dependency `serde`
       please provide path to the corresponding .rmeta file with full metadata
 --> src/main.rs:1:5
  |
1 | use serde;
  |     ^^^^^

error: could not compile `foo` (bin "foo") due to 1 previous error

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.94.0-nightly (6d1bd93c4 2026-01-10)
release: 1.94.0-nightly
commit-hash: 6d1bd93c47f059ec1344cb31e68a2fb284cbc6b1
commit-date: 2026-01-10
host: x86_64-unknown-linux-gnu
libgit2: 1.9.2 (sys:0.20.3 vendored)
libcurl: 8.17.0-DEV (sys:0.4.84+curl-8.17.0 vendored ssl:OpenSSL/3.5.4)
ssl: OpenSSL 3.5.4 30 Sep 2025
os: Debian 13.0.0 (trixie) [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rebuild-detectionArea: rebuild detection and fingerprintingC-bugCategory: bugS-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions