about summary refs log tree commit diff
path: root/src/librustdoc/config.rs
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-07-29 20:19:52 +1000
committerGitHub <noreply@github.com>2025-07-29 20:19:52 +1000
commit03bb80c25453a58cec0b918c57402fe6e6372ea6 (patch)
tree440c191b1d27c76d02a9a70ce354212b09f95de8 /src/librustdoc/config.rs
parent0abc0c4201b6c6d892c3e280753c8ba07c1d8fd2 (diff)
parent327ee15959949c808da2498f7337a5fa5e415c08 (diff)
downloadrust-03bb80c25453a58cec0b918c57402fe6e6372ea6.tar.gz
rust-03bb80c25453a58cec0b918c57402fe6e6372ea6.zip
Rollup merge of #144600 - Noratrieb:rustdoc-dep-info-paths, r=GuillaumeGomez
Ensure external paths passed via flags end up in rustdoc depinfo

rustdoc has many flags to pass external HTML/Markdown/CSS files that end up in the build. These need to be recorded in depinfo so that Cargo will rebuild the crate if they change.
Diffstat (limited to 'src/librustdoc/config.rs')
-rw-r--r--src/librustdoc/config.rs20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs
index 57456e906de..fed4296fa22 100644
--- a/src/librustdoc/config.rs
+++ b/src/librustdoc/config.rs
@@ -380,7 +380,7 @@ impl Options {
         early_dcx: &mut EarlyDiagCtxt,
         matches: &getopts::Matches,
         args: Vec<String>,
-    ) -> Option<(InputMode, Options, RenderOptions)> {
+    ) -> Option<(InputMode, Options, RenderOptions, Vec<PathBuf>)> {
         // Check for unstable options.
         nightly_options::check_nightly_options(early_dcx, matches, &opts());
 
@@ -643,10 +643,13 @@ impl Options {
 
         let extension_css = matches.opt_str("e").map(|s| PathBuf::from(&s));
 
-        if let Some(ref p) = extension_css
-            && !p.is_file()
-        {
-            dcx.fatal("option --extend-css argument must be a file");
+        let mut loaded_paths = Vec::new();
+
+        if let Some(ref p) = extension_css {
+            loaded_paths.push(p.clone());
+            if !p.is_file() {
+                dcx.fatal("option --extend-css argument must be a file");
+            }
         }
 
         let mut themes = Vec::new();
@@ -690,6 +693,7 @@ impl Options {
                     ))
                     .emit();
                 }
+                loaded_paths.push(theme_file.clone());
                 themes.push(StylePath { path: theme_file });
             }
         }
@@ -708,6 +712,7 @@ impl Options {
             &mut id_map,
             edition,
             &None,
+            &mut loaded_paths,
         ) else {
             dcx.fatal("`ExternalHtml::load` failed");
         };
@@ -799,7 +804,8 @@ impl Options {
 
         let scrape_examples_options = ScrapeExamplesOptions::new(matches, dcx);
         let with_examples = matches.opt_strs("with-examples");
-        let call_locations = crate::scrape_examples::load_call_locations(with_examples, dcx);
+        let call_locations =
+            crate::scrape_examples::load_call_locations(with_examples, dcx, &mut loaded_paths);
         let doctest_build_args = matches.opt_strs("doctest-build-arg");
 
         let unstable_features =
@@ -885,7 +891,7 @@ impl Options {
             parts_out_dir,
             disable_minification,
         };
-        Some((input, options, render_options))
+        Some((input, options, render_options, loaded_paths))
     }
 }