cargo icon indicating copy to clipboard operation
cargo copied to clipboard

fix(trim-path): remap paths in build script gen'd code

Open weihanglo opened this issue 7 months ago • 1 comments

What does this PR try to resolve?

Remap paths in build script generated code, by removing the build.build-dir path prefix.

For example, [BUILD_DIR]/debug/build/bar-[HASH]/out/bindings.rs will be remapped to debug/build/bar-[HASH]/out/bindings.rs.

A concrete scenario would be like: A build script may call file! macros, and the associated crate uses include! to include the expanded file! macro in-place via the OUT_DIR environment.

How to test and review this PR?

Should be quite straightforward.

The open question is what we want to remap to, to help debugger to find the source files. cc #12137 and #13171

weihanglo avatar May 31 '25 16:05 weihanglo

r? @epage

rustbot has assigned @epage. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

rustbot avatar May 31 '25 16:05 rustbot

@teknalb this should fix the issue you mentioned in https://github.com/rust-lang/rust/issues/111540#issuecomment-2524209170. It is not yet available in nightly, though.

weihanglo avatar Jun 03 '25 01:06 weihanglo