You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of #151589 - Urgau:documentation-scope, r=GuillaumeGomez
Add a `documentation` remapping path scope for rustdoc usage
This PR adds a new remapping path scope for rustdoc usage: `documentation`, instead of rustdoc abusing the other scopes for it's usage.
Like remapping paths in rustdoc, this scope is unstable. (rustdoc doesn't even have yet an equivalent to [rustc `--remap-path-scope`](https://doc.rust-lang.org/nightly/rustc/remap-source-paths.html#--remap-path-scope)).
I also took the opportunity to add a bit of documentation in rustdoc book.
_ => early_dcx.early_fatal("argument for `--remap-path-scope` must be a comma separated list of scopes: `macro`, `diagnostics`, `debuginfo`, `coverage`, `object`, `all`"),
1344
+
_ => early_dcx.early_fatal("argument for `--remap-path-scope` must be a comma separated list of scopes: `macro`, `diagnostics`, `documentation`, `debuginfo`, `coverage`, `object`, `all`"),
Copy file name to clipboardExpand all lines: src/doc/rustc/src/remap-source-paths.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ The valid scopes are:
52
52
-`debuginfo` - apply remappings to debug information
53
53
-`coverage` - apply remappings to coverage information
54
54
-`object` - apply remappings to all paths in compiled executables or libraries, but not elsewhere. Currently an alias for `macro,coverage,debuginfo`.
55
-
-`all` (default) - an alias for all of the above, also equivalent to supplying only `--remap-path-prefix` without `--remap-path-scope`.
55
+
-`all` (default) - an alias for all of the above (and unstable scopes), also equivalent to supplying only `--remap-path-prefix` without `--remap-path-scope`.
56
56
57
57
The scopes accepted by `--remap-path-scope` are not exhaustive - new scopes may be added in future releases for eventual stabilisation.
58
58
This implies that the `all` scope can correspond to different scopes between releases.
Copy file name to clipboardExpand all lines: src/doc/rustdoc/src/unstable-features.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -751,6 +751,22 @@ pass `--doctest-build-arg ARG` for each argument `ARG`.
751
751
752
752
This flag enables the generation of toggles to expand macros in the HTML source code pages.
753
753
754
+
## `--remap-path-prefix`: Remap source code paths in output
755
+
756
+
This flag is the equivalent flag from `rustc``--remap-path-prefix`.
757
+
758
+
it permits remapping source path prefixes in all output, including compiler diagnostics,
759
+
debug information, macro expansions, etc. It takes a value of the form `FROM=TO`
760
+
where a path prefix equal to `FROM` is rewritten to the value `TO`.
761
+
762
+
### `documentation` scope
763
+
764
+
`rustdoc` (and by extension `rustc`) have a special `documentation` remapping scope, it
765
+
permits remapping source paths that ends up in the generated documentation.
766
+
767
+
Currently the scope can only be specified from `rustc`, due to the lack of an equivalent
768
+
`--remap-path-scope` flag in `rustc`.
769
+
754
770
## `#[doc(cfg)]` and `#[doc(auto_cfg)]`
755
771
756
772
This feature aims at providing rustdoc users the possibility to add visual markers to the rendered documentation to know under which conditions an item is available (currently possible through the following unstable feature: `doc_cfg`).
0 commit comments