Skip to content

Make the documentation scope a sub-scope of the object scope - #164279

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
Urgau:documentation-scope-as-sub-scope-of-object
Oct 16, 2026
Merged

rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
Urgau:documentation-scope-as-sub-scope-of-object

Conversation

@Urgau

@Urgau Urgau commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

First commit from #164278.

This PR moves the documentation scope to be a sub-scope of the object scope.

The object scope is currently defined to be: "This ensures all paths in compiled executables, libraries and objects outputs are remapped but not elsewhere", which can be translated to mean everything written to disk by rustc it-self.

It is therefore a natural extension for the documentation scope to be a sub-scope of it, like macro, debuginfo and coverage, since we use it for things written down on disk, like rustdoc-json (with #164278 at-least) or the source code viewer.

r? @GuillaumeGomez

@rustbot

rustbot commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

These commits modify tests/rustdoc-json.
rustdoc-json is a public (but unstable) interface.

Please ensure that if you've changed the output:

  • It's intentional.
  • The FORMAT_VERSION in src/librustdoc-json-types is bumped if necessary.

cc @obi1kenobi

@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs A-rustdoc-json Area: Rustdoc JSON backend S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Oct 13, 2026
@Urgau

Urgau commented Oct 13, 2026

Copy link
Copy Markdown
Member Author

cc @weihanglo

@weihanglo

Copy link
Copy Markdown
Member

This likely help a lot in these issues:

where we were discussing what scope to pass. If documentation were a subscope of object it is easier for Cargo manage the variants it exposes to its users.

@Urgau
Urgau force-pushed the documentation-scope-as-sub-scope-of-object branch from 78a3248 to 432a29b Compare October 15, 2026 16:34
@rustbot

rustbot commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Urgau

Urgau commented Oct 15, 2026

Copy link
Copy Markdown
Member Author

@GuillaumeGomez #164278 was merged and I rebased. This PR is ready for review.

@GuillaumeGomez

Copy link
Copy Markdown
Member

That was a quick/easy review. :)

Thanks!

@bors r+ rollup

@rust-bors

rust-bors Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 432a29b has been tentatively approved by GuillaumeGomez

It will be put into the queue for this repository once PR CI succeeds.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 15, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 15, 2026
…cope-of-object, r=GuillaumeGomez

Make the `documentation` scope a sub-scope of the `object` scope

~~First commit from rust-lang#164278.~~

This PR moves the `documentation` scope to be a sub-scope of the `object` scope.

The `object` scope is currently defined to be: "This ensures all paths in compiled executables, libraries and objects outputs are remapped but not elsewhere", which can be translated to mean everything written to disk by `rustc` it-self.

It is therefore a natural extension for the `documentation` scope to be a sub-scope of it, like `macro`, `debuginfo` and `coverage`, since we use it for things written down on disk, like rustdoc-json (with rust-lang#164278 at-least) or the source code viewer.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 15, 2026
…cope-of-object, r=GuillaumeGomez

Make the `documentation` scope a sub-scope of the `object` scope

~~First commit from rust-lang#164278.~~

This PR moves the `documentation` scope to be a sub-scope of the `object` scope.

The `object` scope is currently defined to be: "This ensures all paths in compiled executables, libraries and objects outputs are remapped but not elsewhere", which can be translated to mean everything written to disk by `rustc` it-self.

It is therefore a natural extension for the `documentation` scope to be a sub-scope of it, like `macro`, `debuginfo` and `coverage`, since we use it for things written down on disk, like rustdoc-json (with rust-lang#164278 at-least) or the source code viewer.
rust-bors Bot pushed a commit that referenced this pull request Oct 15, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #164271 (Add release notes for 1.99.1)
 - #164361 (delegation: map return even if there is no target expression)
 - #162778 (rustdoc: add disambiguators for identically named method in sidebar)
 - #163224 ([rustdoc] Add tabs to settings popover)
 - #164220 (Test the interaction between `--remap-path-prefix` and doctests)
 - #164279 (Make the `documentation` scope a sub-scope of the `object` scope)
 - #164318 (Fix check with `is_impl_trait_in_trait()` before expecting local id)
 - #164360 (Fix(lib/sys): Restore Win7 compilation)
@JonathanBrouwer

Copy link
Copy Markdown
Member

💔 I suspect this PR failed tests as part of a rollup
@bors r-

After fixing the problem, consider running a try job for the failed job before re-approving.

Link to failure: #164382 (comment)

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 16, 2026
@rust-bors

rust-bors Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#164382), which was unapproved.

View changes since this unapproval

@Urgau

Urgau commented Oct 16, 2026

Copy link
Copy Markdown
Member Author

@bors r=GuillaumeGomez

@rust-bors

rust-bors Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

📌 Commit a48e904 has been tentatively approved by GuillaumeGomez

It will be put into the queue for this repository once PR CI succeeds.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 16, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 16, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #162467 (handle trait solver overflow in `codegen_select_candidate`)
 - #164111 (Fix: Construct byte string valtree array type using literal length)
 - #164227 (refine: respect recursion limit in RPITIT collector to prevent stack overflow)
 - #164279 (Make the `documentation` scope a sub-scope of the `object` scope)
 - #164353 (Update LoongArch64 Linux dist builder to LLVM 23)
 - #164365 (Avoid erased region on transmutability)
 - #164419 (cargotest: update xsv libc for RISC-V)
 - #164422 (Implement after-stack-frame-init-hook)
@rust-bors
rust-bors Bot merged commit 3f0afc0 into rust-lang:main Oct 16, 2026
14 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Oct 16, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 16, 2026
Rollup merge of #164279 - Urgau:documentation-scope-as-sub-scope-of-object, r=GuillaumeGomez

Make the `documentation` scope a sub-scope of the `object` scope

~~First commit from #164278.~~

This PR moves the `documentation` scope to be a sub-scope of the `object` scope.

The `object` scope is currently defined to be: "This ensures all paths in compiled executables, libraries and objects outputs are remapped but not elsewhere", which can be translated to mean everything written to disk by `rustc` it-self.

It is therefore a natural extension for the `documentation` scope to be a sub-scope of it, like `macro`, `debuginfo` and `coverage`, since we use it for things written down on disk, like rustdoc-json (with #164278 at-least) or the source code viewer.
rust-bors Bot pushed a commit that referenced this pull request Nov 27, 2026
…uillaumeGomez

Stabilize `--remap-path-scope` in rustdoc and the `documentation` scope



# Stabilization report of  `--remap-path-scope` in rustdoc and the `documentation` scope

## Summary

`rustc` supports remapping source paths prefixes as a best effort in all compiler generated output, including compiler diagnostics, debugging information, macro expansions, documentation, doctests, etc.

This is useful for normalizing build products, for example, by removing the current directory out of the paths emitted into object files.

This stabilization stabilize the same flag used by `rustc` to control which generted output has remapped paths in `rustdoc`.

Cargo is starting to use the `rustc` flag with rust-lang/cargo#17488. 

Tracking issue: #155451.

It's the last major part of the trim-paths feature.

### What is stabilized

The rustdoc `--remap-path-scope` flag is being stabilized by this PR. It's equivalent to [the rustc flag](https://doc.rust-lang.org/rustc/remap-source-paths.html#--remap-path-scope).

It permits defines which scopes should be remapped by `-–remap-path-prefix`: `macro,diagnostics,documentation,debuginfo,coverage,object,all`.

#### Example

```sh
rustdoc src/lib.rs --remap-path-prefix="$PWD=/foo" --remap-path-prefix=documentation
```

#### The `documentation`

In addition to the [other scopes](https://doc.rust-lang.org/rustc/remap-source-paths.html#--remap-path-scope) (`diagnostics`, `debuginfo`, ...). `rustdoc` uses the `documentation` scope, it's a new scope to be shared with `rustc` (T-compiler [FCP here](#163896)).

## Implementation

### Major parts

- #155357
- #151589
- #163956
- #164278
- #164279

### Coverage

- [`tests/rustdoc-ui/remap-path-prefix.rs`](https://github.com/rust-lang/rust/blob/b57eb9a5fd94f30697f51fc88fbe898e67c7aae6/tests/rustdoc-ui/remap-path-prefix.rs)
- [`tests/rustdoc-ui/remap-path-prefix-doctest.rs`](https://github.com/rust-lang/rust/blob/b57eb9a5fd94f30697f51fc88fbe898e67c7aae6/tests/rustdoc-ui/remap-path-prefix-doctest.rs)
- [`tests/ui/errors/remap-path-prefix-macro.rs`](https://github.com/rust-lang/rust/blob/b57eb9a5fd94f30697f51fc88fbe898e67c7aae6/tests/ui/errors/remap-path-prefix-macro.rs)
- [`tests/ui/errors/remap-path-prefix-diagnostics.rs`](https://github.com/rust-lang/rust/blob/b57eb9a5fd94f30697f51fc88fbe898e67c7aae6/tests/ui/errors/remap-path-prefix-diagnostics.rs)

### Outstanding bugs

There are no outstanding bugs regarding `--remap-path-scope` in `rustdoc`.

There are [caveats and limitation](https://doc.rust-lang.org/nightly/rustc/remap-source-paths.html#caveats-and-limitations) in `rustc`, but they mostly concern generated object files, which we don't really have. 

### Outstanding FIXMEs

There are no FIXME regarding `--remap-path-scope` (in rustc or rustdoc).

Fixes #163896
Fixes #155451
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 27, 2026
…ustdoc, r=GuillaumeGomez

Stabilize `--remap-path-scope` in rustdoc and the `documentation` scope

# Stabilization report of  `--remap-path-scope` in rustdoc and the `documentation` scope

## Summary

`rustc` supports remapping source paths prefixes as a best effort in all compiler generated output, including compiler diagnostics, debugging information, macro expansions, documentation, doctests, etc.

This is useful for normalizing build products, for example, by removing the current directory out of the paths emitted into object files.

This stabilization stabilize the same flag used by `rustc` to control which generted output has remapped paths in `rustdoc`.

Cargo is starting to use the `rustc` flag with rust-lang/cargo#17488.

Tracking issue: rust-lang#155451.

It's the last major part of the trim-paths feature.

### What is stabilized

The rustdoc `--remap-path-scope` flag is being stabilized by this PR. It's equivalent to [the rustc flag](https://doc.rust-lang.org/rustc/remap-source-paths.html#--remap-path-scope).

It permits defines which scopes should be remapped by `-–remap-path-prefix`: `macro,diagnostics,documentation,debuginfo,coverage,object,all`.

#### Example

```sh
rustdoc src/lib.rs --remap-path-prefix="$PWD=/foo" --remap-path-prefix=documentation
```

#### The `documentation`

In addition to the [other scopes](https://doc.rust-lang.org/rustc/remap-source-paths.html#--remap-path-scope) (`diagnostics`, `debuginfo`, ...). `rustdoc` uses the `documentation` scope, it's a new scope to be shared with `rustc` (T-compiler [FCP here](rust-lang#163896)).

## Implementation

### Major parts

- rust-lang#155357
- rust-lang#151589
- rust-lang#163956
- rust-lang#164278
- rust-lang#164279

### Coverage

- [`tests/rustdoc-ui/remap-path-prefix.rs`](https://github.com/rust-lang/rust/blob/b57eb9a5fd94f30697f51fc88fbe898e67c7aae6/tests/rustdoc-ui/remap-path-prefix.rs)
- [`tests/rustdoc-ui/remap-path-prefix-doctest.rs`](https://github.com/rust-lang/rust/blob/b57eb9a5fd94f30697f51fc88fbe898e67c7aae6/tests/rustdoc-ui/remap-path-prefix-doctest.rs)
- [`tests/ui/errors/remap-path-prefix-macro.rs`](https://github.com/rust-lang/rust/blob/b57eb9a5fd94f30697f51fc88fbe898e67c7aae6/tests/ui/errors/remap-path-prefix-macro.rs)
- [`tests/ui/errors/remap-path-prefix-diagnostics.rs`](https://github.com/rust-lang/rust/blob/b57eb9a5fd94f30697f51fc88fbe898e67c7aae6/tests/ui/errors/remap-path-prefix-diagnostics.rs)

### Outstanding bugs

There are no outstanding bugs regarding `--remap-path-scope` in `rustdoc`.

There are [caveats and limitation](https://doc.rust-lang.org/nightly/rustc/remap-source-paths.html#caveats-and-limitations) in `rustc`, but they mostly concern generated object files, which we don't really have.

### Outstanding FIXMEs

There are no FIXME regarding `--remap-path-scope` (in rustc or rustdoc).

Fixes rust-lang#163896
Fixes rust-lang#155451
rust-bors Bot pushed a commit that referenced this pull request Nov 27, 2026
…uillaumeGomez

Stabilize `--remap-path-scope` in rustdoc and the `documentation` scope



# Stabilization report of  `--remap-path-scope` in rustdoc and the `documentation` scope

## Summary

`rustc` supports remapping source paths prefixes as a best effort in all compiler generated output, including compiler diagnostics, debugging information, macro expansions, documentation, doctests, etc.

This is useful for normalizing build products, for example, by removing the current directory out of the paths emitted into object files.

This stabilization stabilize the same flag used by `rustc` to control which generted output has remapped paths in `rustdoc`.

Cargo is starting to use the `rustc` flag with rust-lang/cargo#17488. 

Tracking issue: #155451.

It's the last major part of the trim-paths feature.

### What is stabilized

The rustdoc `--remap-path-scope` flag is being stabilized by this PR. It's equivalent to [the rustc flag](https://doc.rust-lang.org/rustc/remap-source-paths.html#--remap-path-scope).

It permits defines which scopes should be remapped by `-–remap-path-prefix`: `macro,diagnostics,documentation,debuginfo,coverage,object,all`.

#### Example

```sh
rustdoc src/lib.rs --remap-path-prefix="$PWD=/foo" --remap-path-prefix=documentation
```

#### The `documentation`

In addition to the [other scopes](https://doc.rust-lang.org/rustc/remap-source-paths.html#--remap-path-scope) (`diagnostics`, `debuginfo`, ...). `rustdoc` uses the `documentation` scope, it's a new scope to be shared with `rustc` (T-compiler [FCP here](#163896)).

## Implementation

### Major parts

- #155357
- #151589
- #163956
- #164278
- #164279

### Coverage

- [`tests/rustdoc-ui/remap-path-prefix.rs`](https://github.com/rust-lang/rust/blob/b57eb9a5fd94f30697f51fc88fbe898e67c7aae6/tests/rustdoc-ui/remap-path-prefix.rs)
- [`tests/rustdoc-ui/remap-path-prefix-doctest.rs`](https://github.com/rust-lang/rust/blob/b57eb9a5fd94f30697f51fc88fbe898e67c7aae6/tests/rustdoc-ui/remap-path-prefix-doctest.rs)
- [`tests/ui/errors/remap-path-prefix-macro.rs`](https://github.com/rust-lang/rust/blob/b57eb9a5fd94f30697f51fc88fbe898e67c7aae6/tests/ui/errors/remap-path-prefix-macro.rs)
- [`tests/ui/errors/remap-path-prefix-diagnostics.rs`](https://github.com/rust-lang/rust/blob/b57eb9a5fd94f30697f51fc88fbe898e67c7aae6/tests/ui/errors/remap-path-prefix-diagnostics.rs)

### Outstanding bugs

There are no outstanding bugs regarding `--remap-path-scope` in `rustdoc`.

There are [caveats and limitation](https://doc.rust-lang.org/nightly/rustc/remap-source-paths.html#caveats-and-limitations) in `rustc`, but they mostly concern generated object files, which we don't really have. 

### Outstanding FIXMEs

There are no FIXME regarding `--remap-path-scope` (in rustc or rustdoc).

Fixes #163896
Fixes #155451
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 27, 2026
…ustdoc, r=GuillaumeGomez

Stabilize `--remap-path-scope` in rustdoc and the `documentation` scope

# Stabilization report of  `--remap-path-scope` in rustdoc and the `documentation` scope

## Summary

`rustc` supports remapping source paths prefixes as a best effort in all compiler generated output, including compiler diagnostics, debugging information, macro expansions, documentation, doctests, etc.

This is useful for normalizing build products, for example, by removing the current directory out of the paths emitted into object files.

This stabilization stabilize the same flag used by `rustc` to control which generted output has remapped paths in `rustdoc`.

Cargo is starting to use the `rustc` flag with rust-lang/cargo#17488.

Tracking issue: rust-lang#155451.

It's the last major part of the trim-paths feature.

### What is stabilized

The rustdoc `--remap-path-scope` flag is being stabilized by this PR. It's equivalent to [the rustc flag](https://doc.rust-lang.org/rustc/remap-source-paths.html#--remap-path-scope).

It permits defines which scopes should be remapped by `-–remap-path-prefix`: `macro,diagnostics,documentation,debuginfo,coverage,object,all`.

#### Example

```sh
rustdoc src/lib.rs --remap-path-prefix="$PWD=/foo" --remap-path-prefix=documentation
```

#### The `documentation`

In addition to the [other scopes](https://doc.rust-lang.org/rustc/remap-source-paths.html#--remap-path-scope) (`diagnostics`, `debuginfo`, ...). `rustdoc` uses the `documentation` scope, it's a new scope to be shared with `rustc` (T-compiler [FCP here](rust-lang#163896)).

## Implementation

### Major parts

- rust-lang#155357
- rust-lang#151589
- rust-lang#163956
- rust-lang#164278
- rust-lang#164279

### Coverage

- [`tests/rustdoc-ui/remap-path-prefix.rs`](https://github.com/rust-lang/rust/blob/b57eb9a5fd94f30697f51fc88fbe898e67c7aae6/tests/rustdoc-ui/remap-path-prefix.rs)
- [`tests/rustdoc-ui/remap-path-prefix-doctest.rs`](https://github.com/rust-lang/rust/blob/b57eb9a5fd94f30697f51fc88fbe898e67c7aae6/tests/rustdoc-ui/remap-path-prefix-doctest.rs)
- [`tests/ui/errors/remap-path-prefix-macro.rs`](https://github.com/rust-lang/rust/blob/b57eb9a5fd94f30697f51fc88fbe898e67c7aae6/tests/ui/errors/remap-path-prefix-macro.rs)
- [`tests/ui/errors/remap-path-prefix-diagnostics.rs`](https://github.com/rust-lang/rust/blob/b57eb9a5fd94f30697f51fc88fbe898e67c7aae6/tests/ui/errors/remap-path-prefix-diagnostics.rs)

### Outstanding bugs

There are no outstanding bugs regarding `--remap-path-scope` in `rustdoc`.

There are [caveats and limitation](https://doc.rust-lang.org/nightly/rustc/remap-source-paths.html#caveats-and-limitations) in `rustc`, but they mostly concern generated object files, which we don't really have.

### Outstanding FIXMEs

There are no FIXME regarding `--remap-path-scope` (in rustc or rustdoc).

Fixes rust-lang#163896
Fixes rust-lang#155451
rust-bors Bot pushed a commit that referenced this pull request Nov 27, 2026
Rollup merge of #163895 - Urgau:stabilize-remap-path-scope-rustdoc, r=GuillaumeGomez

Stabilize `--remap-path-scope` in rustdoc and the `documentation` scope

# Stabilization report of  `--remap-path-scope` in rustdoc and the `documentation` scope

## Summary

`rustc` supports remapping source paths prefixes as a best effort in all compiler generated output, including compiler diagnostics, debugging information, macro expansions, documentation, doctests, etc.

This is useful for normalizing build products, for example, by removing the current directory out of the paths emitted into object files.

This stabilization stabilize the same flag used by `rustc` to control which generted output has remapped paths in `rustdoc`.

Cargo is starting to use the `rustc` flag with rust-lang/cargo#17488.

Tracking issue: #155451.

It's the last major part of the trim-paths feature.

### What is stabilized

The rustdoc `--remap-path-scope` flag is being stabilized by this PR. It's equivalent to [the rustc flag](https://doc.rust-lang.org/rustc/remap-source-paths.html#--remap-path-scope).

It permits defines which scopes should be remapped by `-–remap-path-prefix`: `macro,diagnostics,documentation,debuginfo,coverage,object,all`.

#### Example

```sh
rustdoc src/lib.rs --remap-path-prefix="$PWD=/foo" --remap-path-prefix=documentation
```

#### The `documentation`

In addition to the [other scopes](https://doc.rust-lang.org/rustc/remap-source-paths.html#--remap-path-scope) (`diagnostics`, `debuginfo`, ...). `rustdoc` uses the `documentation` scope, it's a new scope to be shared with `rustc` (T-compiler [FCP here](#163896)).

## Implementation

### Major parts

- #155357
- #151589
- #163956
- #164278
- #164279

### Coverage

- [`tests/rustdoc-ui/remap-path-prefix.rs`](https://github.com/rust-lang/rust/blob/b57eb9a5fd94f30697f51fc88fbe898e67c7aae6/tests/rustdoc-ui/remap-path-prefix.rs)
- [`tests/rustdoc-ui/remap-path-prefix-doctest.rs`](https://github.com/rust-lang/rust/blob/b57eb9a5fd94f30697f51fc88fbe898e67c7aae6/tests/rustdoc-ui/remap-path-prefix-doctest.rs)
- [`tests/ui/errors/remap-path-prefix-macro.rs`](https://github.com/rust-lang/rust/blob/b57eb9a5fd94f30697f51fc88fbe898e67c7aae6/tests/ui/errors/remap-path-prefix-macro.rs)
- [`tests/ui/errors/remap-path-prefix-diagnostics.rs`](https://github.com/rust-lang/rust/blob/b57eb9a5fd94f30697f51fc88fbe898e67c7aae6/tests/ui/errors/remap-path-prefix-diagnostics.rs)

### Outstanding bugs

There are no outstanding bugs regarding `--remap-path-scope` in `rustdoc`.

There are [caveats and limitation](https://doc.rust-lang.org/nightly/rustc/remap-source-paths.html#caveats-and-limitations) in `rustc`, but they mostly concern generated object files, which we don't really have.

### Outstanding FIXMEs

There are no FIXME regarding `--remap-path-scope` (in rustc or rustdoc).

Fixes #163896
Fixes #155451
mehmettoplu-rs pushed a commit to mehmettoplu-rs/miri that referenced this pull request Nov 28, 2026
…=GuillaumeGomez

Stabilize `--remap-path-scope` in rustdoc and the `documentation` scope

# Stabilization report of  `--remap-path-scope` in rustdoc and the `documentation` scope

## Summary

`rustc` supports remapping source paths prefixes as a best effort in all compiler generated output, including compiler diagnostics, debugging information, macro expansions, documentation, doctests, etc.

This is useful for normalizing build products, for example, by removing the current directory out of the paths emitted into object files.

This stabilization stabilize the same flag used by `rustc` to control which generted output has remapped paths in `rustdoc`.

Cargo is starting to use the `rustc` flag with rust-lang/cargo#17488.

Tracking issue: rust-lang/rust#155451.

It's the last major part of the trim-paths feature.

### What is stabilized

The rustdoc `--remap-path-scope` flag is being stabilized by this PR. It's equivalent to [the rustc flag](https://doc.rust-lang.org/rustc/remap-source-paths.html#--remap-path-scope).

It permits defines which scopes should be remapped by `-–remap-path-prefix`: `macro,diagnostics,documentation,debuginfo,coverage,object,all`.

#### Example

```sh
rustdoc src/lib.rs --remap-path-prefix="$PWD=/foo" --remap-path-prefix=documentation
```

#### The `documentation`

In addition to the [other scopes](https://doc.rust-lang.org/rustc/remap-source-paths.html#--remap-path-scope) (`diagnostics`, `debuginfo`, ...). `rustdoc` uses the `documentation` scope, it's a new scope to be shared with `rustc` (T-compiler [FCP here](rust-lang/rust#163896)).

## Implementation

### Major parts

- rust-lang/rust#155357
- rust-lang/rust#151589
- rust-lang/rust#163956
- rust-lang/rust#164278
- rust-lang/rust#164279

### Coverage

- [`tests/rustdoc-ui/remap-path-prefix.rs`](https://github.com/rust-lang/rust/blob/b57eb9a5fd94f30697f51fc88fbe898e67c7aae6/tests/rustdoc-ui/remap-path-prefix.rs)
- [`tests/rustdoc-ui/remap-path-prefix-doctest.rs`](https://github.com/rust-lang/rust/blob/b57eb9a5fd94f30697f51fc88fbe898e67c7aae6/tests/rustdoc-ui/remap-path-prefix-doctest.rs)
- [`tests/ui/errors/remap-path-prefix-macro.rs`](https://github.com/rust-lang/rust/blob/b57eb9a5fd94f30697f51fc88fbe898e67c7aae6/tests/ui/errors/remap-path-prefix-macro.rs)
- [`tests/ui/errors/remap-path-prefix-diagnostics.rs`](https://github.com/rust-lang/rust/blob/b57eb9a5fd94f30697f51fc88fbe898e67c7aae6/tests/ui/errors/remap-path-prefix-diagnostics.rs)

### Outstanding bugs

There are no outstanding bugs regarding `--remap-path-scope` in `rustdoc`.

There are [caveats and limitation](https://doc.rust-lang.org/nightly/rustc/remap-source-paths.html#caveats-and-limitations) in `rustc`, but they mostly concern generated object files, which we don't really have.

### Outstanding FIXMEs

There are no FIXME regarding `--remap-path-scope` (in rustc or rustdoc).

Fixes rust-lang/rust#163896
Fixes rust-lang/rust#155451
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-run-make Area: port run-make Makefiles to rmake.rs A-rustdoc-json Area: Rustdoc JSON backend S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants