Skip to content

Tracking Issue for trim-paths RFC 3127 #111540

Closed
rust-lang/cargo
#17488

Description

@ehuss

View all comments

This is a tracking issue for the RFC 3127 (rust-lang/rfcs#3127).

This enhancement adds the --remap-path-scope command-line flag to control the scoping of how paths get remapped in the resulting binary.

Issues: F-trim-paths Feature: trim-paths
Documentation (rustc): https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/remap-path-scope.html
Documentation (cargo): https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#profile-trim-paths-option
Cargo tracking issue: rust-lang/cargo#12137

About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

Steps

Unresolved Questions

Implementation history

Activity

  1. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    T-cargoRelevant to the cargo team, which will review and decide on the PR/issue.
    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
    B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.
    on May 13, 2023
  2. added 6 commits that reference this issue on Oct 3, 2023
  3. weihanglo commented on Nov 5, 2023

    @weihanglo
    Member

    I was trying to remove OSO symbols on macOS. Did a research and summarized in this issue: #116948 (comment). Now, I can see that there is no way for trim-paths to really trim all paths unless rustc does some dirty trick for older macOS platforms. Would it be a blocker if we want to stabilize this feature, say, in 2024 edition?

    cc @Urgau you might be interested.

  4. michaelwoerister commented on Dec 12, 2023

    @michaelwoerister
    Member

    What concerns are there regarding the use of relative paths causing issues with backtraces and debuggers?

    I talked about this with @danielframpton the other day and he noticed that the current [package name]-[version] rule for remapping might make things unnecessarily complicated for debuggers. For making the debugging experience easy to set up, it would be beneficial to require as little configuration as possible. The RFC does not explicitly make file system paths (as used by Cargo) match with how things are renamed, so in the general case the debugger needs a separate source file search path for each crate involved.

    However, if we prescribed that each crate from was remapped to the relative path Cargo uses inside its $CARGO_HOME/registry/src and $CARGO_HOME/git/checkouts directories, then we have a fixed number of source directories a debugger needs to know about. The renaming would then be [registry]/[package name]-[version] for registry crates and [package name]-[sha] for git dependencies.

    The current [package name]-[version] rule is already pretty close, but that seems to be by accident. It would be good to make this something that can be relied on.

    This might also help with backtraces?

    I don't know if there is something similarly useful we can do for path dependencies.

    Should we treat the current package the same as other packages?

    This also came up. Unconditionally stripping the path to the current package might be too inflexible in some cases. E.g. when building a staticlib, one might want to make the paths coming from the current package identifiable in some way. If they all start with src/.. then they might clash with the paths of the codebase that uses the staticlib as a dependency.

  5. 61 remaining items

  6. added a commit that references this issue on Jan 20, 2026
  7. added a commit that references this issue on Jan 20, 2026
  8. ulrichard commented on Jan 21, 2026

    @ulrichard

    I am trying to build reproducibly whether I get the dependencies directly from crates.io or through artifactory on the CI server.
    After stripping debug info in release builds I don't see the strings in the resulting binaries, but lots of addresses are different. My suspicion is that there is still some hash over the cache location of the dependencies.
    Is this in scope for this issue?

  9. weihanglo commented on Jan 21, 2026

    @weihanglo
    Member

    @ulrichard
    That would likely be an issue of how Cargo determine rustc metadata hash. This tracking issue is for rustc to trim paths in binaries only. Please open issue in https://github.com/rust-lang/cargo/issues/new/choose with steps to repro or at least support materials that maintainers can look at. Thank you.

  10. weihanglo commented on Sep 10, 2026

    @weihanglo
    Member

    FWIW, Cargo part of this feature is calling for testing. For more details, see rust-lang/cargo#12137 (comment).

  11. added a commit that references this issue on Oct 6, 2026
    784be26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-backtraceArea: BacktracesA-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)A-reproducibilityArea: Reproducible / deterministic buildsB-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCF-trim-pathsFeature: trim-pathsT-cargoRelevant to the cargo team, which will review and decide on the PR/issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions