Skip to content

Separate target directories by a hash of flags and other inputs? #3130

Closed
@anp

Description

@anp

I've done some searching in the issues on the cargo repo and haven't seen anything related to this -- if this is a duplicate please forgive me.

Has anyone ever proposed the use of an intermediate directory under target but above debug/release which is specific to a set of flags/build options? Something like target/HASH_OF_INPUTS/debug?

There are a couple of situations where I've recently found myself toggling flags on and off for both debug and release builds, where triggering a full rebuild is problematic:

  • Measuring performance of different code changes with LTO on and then off, debuginfo on and then off, etc.
  • Performing general compiler-driven coding, followed by running line coverage on tests. This means passing no-gc-sections in flags, where I wouldn't want that to be the default in my development environment.

Both of these workflows depend on comparing the effects small code changes across different sets of flags, but to do so currently kicks off a full rebuild of dependencies (which is a really killer amount of time to spend in between edits).

From a user's perspective, I can see a definite downside from disk usage growing as they experiment with different flags. At the same time, it would be nice to have these kinds of workflows "just work" without needing full dependency rebuilds or having to play games with CARGO_TARGET_DIR.

Hopefully I'm making sense here. Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cachingArea: caching of dependencies, repositories, and build artifactsC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions