diff options
Diffstat (limited to 'src/librustdoc/config.rs')
-rw-r--r-- | src/librustdoc/config.rs | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 81fb13f41..99aa97902 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -157,6 +157,12 @@ pub(crate) struct Options { /// Note: this field is duplicated in `RenderOptions` because it's useful /// to have it in both places. pub(crate) unstable_features: rustc_feature::UnstableFeatures, + + /// All commandline args used to invoke the compiler, with @file args fully expanded. + /// This will only be used within debug info, e.g. in the pdb file on windows + /// This is mainly useful for other tools that reads that debuginfo to figure out + /// how to call the compiler with the same arguments. + pub(crate) expanded_args: Vec<String>, } impl fmt::Debug for Options { @@ -273,6 +279,8 @@ pub(crate) struct RenderOptions { pub(crate) call_locations: AllCallLocations, /// If `true`, Context::init will not emit shared files. pub(crate) no_emit_shared: bool, + /// If `true`, HTML source code pages won't be generated. + pub(crate) html_no_source: bool, } #[derive(Copy, Clone, Debug, PartialEq, Eq)] @@ -402,9 +410,15 @@ impl Options { let to_check = matches.opt_strs("check-theme"); if !to_check.is_empty() { - let paths = match theme::load_css_paths( - std::str::from_utf8(static_files::STATIC_FILES.theme_light_css.bytes).unwrap(), - ) { + let mut content = + std::str::from_utf8(static_files::STATIC_FILES.rustdoc_css.bytes).unwrap(); + if let Some((_, inside)) = content.split_once("/* Begin theme: light */") { + content = inside; + } + if let Some((inside, _)) = content.split_once("/* End theme: light */") { + content = inside; + } + let paths = match theme::load_css_paths(content) { Ok(p) => p, Err(e) => { diag.struct_err(e).emit(); @@ -542,9 +556,15 @@ impl Options { let mut themes = Vec::new(); if matches.opt_present("theme") { - let paths = match theme::load_css_paths( - std::str::from_utf8(static_files::STATIC_FILES.theme_light_css.bytes).unwrap(), - ) { + let mut content = + std::str::from_utf8(static_files::STATIC_FILES.rustdoc_css.bytes).unwrap(); + if let Some((_, inside)) = content.split_once("/* Begin theme: light */") { + content = inside; + } + if let Some((inside, _)) = content.split_once("/* End theme: light */") { + content = inside; + } + let paths = match theme::load_css_paths(content) { Ok(p) => p, Err(e) => { diag.struct_err(e).emit(); @@ -686,6 +706,7 @@ impl Options { let generate_link_to_definition = matches.opt_present("generate-link-to-definition"); let extern_html_root_takes_precedence = matches.opt_present("extern-html-root-takes-precedence"); + let html_no_source = matches.opt_present("html-no-source"); if generate_link_to_definition && (show_coverage || output_format != OutputFormat::Html) { diag.struct_err( @@ -741,6 +762,7 @@ impl Options { json_unused_externs, scrape_examples_options, unstable_features, + expanded_args: args, }; let render_options = RenderOptions { output, @@ -769,6 +791,7 @@ impl Options { generate_link_to_definition, call_locations, no_emit_shared: false, + html_no_source, }; Ok((options, render_options)) } |