From fd89197d1bea9799302c3584781585c517ca9240 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 6 Aug 2024 16:47:47 +0200 Subject: [PATCH 1/2] Fix rustdoc missing handling of `remap-path-prefix` option --- src/librustdoc/core.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 3e1271f198ca7..fea31e7ecbc9a 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -195,6 +195,7 @@ pub(crate) fn create_config( lint_cap, scrape_examples_options, expanded_args, + remap_path_prefix, .. }: RustdocOptions, RenderOptions { document_private, .. }: &RenderOptions, @@ -247,6 +248,7 @@ pub(crate) fn create_config( describe_lints, crate_name, test, + remap_path_prefix, ..Options::default() }; From f43e92b4dfe70b9def4f369794c0d703faae2665 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 6 Aug 2024 16:48:13 +0200 Subject: [PATCH 2/2] Add regression test for #69264 --- tests/rustdoc-ui/remap-path-prefix-lint.rs | 10 ++++++++++ tests/rustdoc-ui/remap-path-prefix-lint.stderr | 14 ++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 tests/rustdoc-ui/remap-path-prefix-lint.rs create mode 100644 tests/rustdoc-ui/remap-path-prefix-lint.stderr diff --git a/tests/rustdoc-ui/remap-path-prefix-lint.rs b/tests/rustdoc-ui/remap-path-prefix-lint.rs new file mode 100644 index 0000000000000..f27863e825d93 --- /dev/null +++ b/tests/rustdoc-ui/remap-path-prefix-lint.rs @@ -0,0 +1,10 @@ +// Regression test for remapped paths in rustdoc errors +// . + +//@ compile-flags:-Z unstable-options --remap-path-prefix={{src-base}}=remapped_path +//@ rustc-env:RUST_BACKTRACE=0 + +#![deny(rustdoc::invalid_html_tags)] + +/// +pub struct Bar; diff --git a/tests/rustdoc-ui/remap-path-prefix-lint.stderr b/tests/rustdoc-ui/remap-path-prefix-lint.stderr new file mode 100644 index 0000000000000..d7c1bb1965d35 --- /dev/null +++ b/tests/rustdoc-ui/remap-path-prefix-lint.stderr @@ -0,0 +1,14 @@ +error: unopened HTML tag `script` + --> remapped_path/remap-path-prefix-lint.rs:9:5 + | +LL | /// + | ^^^^^^^^^ + | +note: the lint level is defined here + --> remapped_path/remap-path-prefix-lint.rs:7:9 + | +LL | #![deny(rustdoc::invalid_html_tags)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error +