Skip to content

Spurious rebuilds of ring: the env variable CARGO_MANIFEST_DIR changed #16134

@kryptan

Description

@kryptan

Problem

I have noticed that cargo likes to sometimes rebuild ring for no apparent reason. It happens randomly and is very hard to reproduce. I managed to catch it once with verbose output and it says that variable CARGO_MANIFEST_DIR has changed. I do not set any env variables, this is just a regular cargo project with no unusual build settings.

       ...
       Fresh toml v0.9.8
       Fresh mio v1.0.4
       Dirty ring v0.17.14: the env variable CARGO_MANIFEST_DIR changed
   Compiling ring v0.17.14
       Fresh futures-task v0.3.31
       Fresh slab v0.4.11
       ...

Looks like ring build script is outputting rerun-if-env-changed=CARGO_MANIFEST_DIR which is invalid usage but I don't think it should cause random rebuilds.

Steps

  1. Have a large project with many dependencies, including ring.
  2. Perform many incremental rebuilds of your project. Sometimes ring might get rebuild.

Possible Solution(s)

No response

Notes

No response

Version

> cargo version --verbose
cargo 1.92.0-nightly (367fd9f21 2025-10-15)
release: 1.92.0-nightly
commit-hash: 367fd9f213750cd40317803dd0a5a3ce3f0c676d
commit-date: 2025-10-15
host: x86_64-pc-windows-msvc
libgit2: 1.9.1 (sys:0.20.2 vendored)
libcurl: 8.15.0-DEV (sys:0.4.83+curl-8.15.0 vendored ssl:Schannel)
os: Windows 10.0.26100 (Windows 11 Enterprise) [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-build-scriptsArea: build.rs scriptsA-rebuild-detectionArea: rebuild detection and fingerprintingC-bugCategory: bugS-needs-infoStatus: Needs more info, such as a reproduction or more background for a feature request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions