cargo icon indicating copy to clipboard operation
cargo copied to clipboard

Tracking Issue for trim-paths RFC 3127

Open ehuss opened this issue 2 years ago • 12 comments

Summary

RFC: #3127 Documentation: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#profile-trim-paths-option Issues: https://github.com/rust-lang/cargo/labels/Z-trim-paths rustc tracking issue: https://github.com/rust-lang/rust/issues/111540

This adds a new profile setting (among other things) to control how paths are sanitized in the resulting binary.

Unresolved Issues

  • [ ] Should make --remap-path-prefix work with rustdoc and doctest?
    • Yes as rustdoc supports both
      • https://github.com/rust-lang/rust/pull/107099
      • https://github.com/rust-lang/rust/pull/128736
    • [x] Integrate --remap-path-prefix in rustdoc invocations (cargo doc) https://github.com/rust-lang/cargo/pull/14389
    • [ ] Integrate --remap-path-prefix and -Zremap-path-scope in doctest (cargo test --doc)
  • [ ] Determine the remap rules: https://github.com/rust-lang/cargo/issues/13171
    • [x] A cross-platform stable hash for CARGO_HOME layout? https://github.com/rust-lang/cargo/pull/14917
      • [x] On Windows the local path contains prefix component e.g.C:/, which essentially results in a different hash result from what on other platforms. This is unlikely to be resolved.
      • [x] benchmark BLAKE3, BLAKE2s, and rustc-stable-hasher
  • [ ] There should be some tests for Windows and macOS
    • Be sure to consider the impact of back versus forward slashes, and whether or not that will work with either.

Future Extensions

No response

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.

Implementation history

  • https://github.com/rust-lang/cargo/pull/12625
  • https://github.com/rust-lang/cargo/pull/12900
  • https://github.com/rust-lang/cargo/pull/12908
  • https://github.com/rust-lang/cargo/pull/14389
  • https://github.com/rust-lang/cargo/pull/14908
  • https://github.com/rust-lang/cargo/pull/15614

ehuss avatar May 13 '23 17:05 ehuss

Last status update I'm aware of

https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/trim-paths.20testing/near/401425246

epage avatar May 29 '24 22:05 epage

Is this working on Linux, well enough that we could ship it for Linux without promising macOS support?

joshtriplett avatar May 29 '24 23:05 joshtriplett

This is the latest status of it on rustc side: https://github.com/rust-lang/rust/issues/111540#issuecomment-2014748609, which the new remap rule in the conclusion is implemented. I've updated the unresolved issues section in this tracking issue.

weihanglo avatar May 29 '24 23:05 weihanglo

Status update:

  • This change https://github.com/rust-lang/rust/pull/107099 should make -Ztrim-paths also work for rustdoc
  • A stable hasher extracting from rustc is on its way. See also
    • https://github.com/rust-lang/compiler-team/issues/755
    • https://github.com/rust-lang/rustc-stable-hash/pull/1

weihanglo avatar Jun 05 '24 11:06 weihanglo

https://github.com/rust-lang/rust/pull/107099 is just merged, so should be able to support for rustdoc.

Edit: need to adjust cargo to pass --remap-path-prefix to rustdoc invocations.

weihanglo avatar Jun 10 '24 03:06 weihanglo

Updated:

That potentially blocks this, if we would like to see -Ztrim-paths supports also for rustdoc invocations.

weihanglo avatar Aug 01 '24 14:08 weihanglo

Updated:

That potentially blocks this, if we would like to see -Ztrim-paths supports also for rustdoc invocations.

both of those linked are closed/merged what is left blocking to get trimpaths working?

liciana24 avatar Aug 07 '24 13:08 liciana24

both of those linked are closed/merged what is left blocking to get trimpaths working?

@liciana24 There are some unresolved issues listed in the PR description I just updated.

It should minimally work. Any feedback of it not working?

weihanglo avatar Aug 07 '24 13:08 weihanglo

status?

lina9992006 avatar Nov 12 '24 14:11 lina9992006

@lina9992006 Just posted benchmark results here for different stable hash algorithms: https://github.com/rust-lang/cargo/pull/14116#issuecomment-2486293308

If you'd like to move this forward, here are areas we need helps:

  • Resolving issues mentioned in the PR description.
  • Testing out the current implementation and provide feedback.

weihanglo avatar Nov 19 '24 21:11 weihanglo

why is hashing relevant here?

lina9992006 avatar Nov 20 '24 00:11 lina9992006

A stable cross-platform hash algorithm helps -Ztrim-paths finding sources from the same path when debugging. See https://github.com/rust-lang/cargo/issues/13171#issuecomment-1864899037 and other comments around.

weihanglo avatar Nov 20 '24 01:11 weihanglo