mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-04 17:22:19 +00:00
Pass the unremapped path to the `rustc` invocation for doctests
Turns out that `--remap-path-scope` is only half working with doctests, this is because `rustdoc` use a secret environment variable to pass the real filename of the doctest.
However we were only passing a remapped path. That means that doctests source path were getting remapped, but only for one scope: `documentation`. It didn't respect `macro` for `file!` for example.
To fix this, we have to:
1. pass the local path to the `rustc` invocation
2. have `rustc` treat that path as a real filename and apply remapping per scope to it
- I had to add a new `Input` variant, otherwise I can't differentiate normal input `-` from doctests `-` source
4. we have to pass `--remap-path-{prefix,scope}` to `rustc` so the path actually gets remap properly