Skip to content

Support different paths remapping for different scopes #142917

Description

@Urgau

I want to raise that I think it should be possible to apply different remapping to the same path for different scopes. It seems like remap-path-prefix was too generic in remapping across many different use cases, and now the scope argument is being introduced to limit the scope, but that doesn't deal with the situation where you want to remap the same path differently across scopes.

E.g. imagine I want to remap /home/cameron/code/project to "." for macro, but to "" for split-debuginfo. This would be necessary on macOS, where OSO stabs cannot use relative paths (see #132143).

You could imagine doing something like:

rustc ...
  --remap-path-scope=split-debuginfo \
  --remap-path-prefix=/home/cameron/code/project=. \
  --remap-path-scope=macro \
  --remap-path-prefix=/home/cameron/code/project=

But repeated usage of these flags are independently aggregated, rather than ordered, so that wouldn't work.

Not sure on the right design here, but I do think being able to express ^ is worthwhile.

Originally posted by @csmulhern in #111540

Activity

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-path-remappingArea: path remapping, --remap-path-prefix, --remap-cwd-prefix, --remap-diagnostics-scope etc.F-trim-pathsFeature: trim-pathsT-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