dtolnay / dtolnay/trybuild

Fails to normalize directory if `--remap-path-prefix` is in use

Open
#192 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
998
Forks
84
PR merge metrics
No merged PRs in 30d

Description

I have globally setup my machine to remap some prefixes which include my home directory where I build projects from.

```toml
# ~/.cargo/config.toml
[target.x86_64-unknown-linux-gnu]
rustflags = [
"--remap-path-prefix=/home/nemo157=\u001b[36;1m~\u001b[0m",
]
```

When running `trybuild` based tests this remapping blocks the path normalization from working.

I've tried changing a few things but wasn't able to come up with an entirely satisfying solution to this myself. The only one that managed to work was unconditionally setting `RUSTFLAGS` rather than only overriding that if it exists in the environment, that makes cargo ignore any `.cargo/config` set rustflags. (The other main change I attempted was to add a `[target.$TARGET]` section to the generated `.cargo/config`, that still fails as the flags from these get _merged_ rather than overriding each other).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.