]> git.lizzy.rs Git - rust.git/blobdiff - src/librustdoc/config.rs
Auto merge of #92291 - AngelicosPhosphoros:typeid_inline_revert_92135, r=joshtriplett
[rust.git] / src / librustdoc / config.rs
index ee19567be102fe14169f6b41eb077bc2927031e3..d300afa313237dbd14603f55b57a5252e594cd61 100644 (file)
@@ -24,7 +24,7 @@
 use crate::html::render::StylePath;
 use crate::html::static_files;
 use crate::opts;
-use crate::passes::{self, Condition, DefaultPassOption};
+use crate::passes::{self, Condition};
 use crate::scrape_examples::{AllCallLocations, ScrapeExamplesOptions};
 use crate::theme;
 
@@ -128,14 +128,6 @@ fn try_from(value: &str) -> Result<Self, Self::Error> {
     crate test_builder: Option<PathBuf>,
 
     // Options that affect the documentation process
-    /// The selected default set of passes to use.
-    ///
-    /// Be aware: This option can come both from the CLI and from crate attributes!
-    crate default_passes: DefaultPassOption,
-    /// Any passes manually selected by the user.
-    ///
-    /// Be aware: This option can come both from the CLI and from crate attributes!
-    crate manual_passes: Vec<String>,
     /// Whether to run the `calculate-doc-coverage` pass, which counts the number of public items
     /// with and without documentation.
     crate show_coverage: bool,
@@ -192,8 +184,6 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
             .field("test_args", &self.test_args)
             .field("test_run_directory", &self.test_run_directory)
             .field("persist_doctests", &self.persist_doctests)
-            .field("default_passes", &self.default_passes)
-            .field("manual_passes", &self.manual_passes)
             .field("show_coverage", &self.show_coverage)
             .field("crate_version", &self.crate_version)
             .field("render_options", &self.render_options)
@@ -282,7 +272,10 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
     crate emit: Vec<EmitType>,
     /// If `true`, HTML source pages will generate links for items to their definition.
     crate generate_link_to_definition: bool,
+    /// Set of function-call locations to include as examples
     crate call_locations: AllCallLocations,
+    /// If `true`, Context::init will not emit shared files.
+    crate no_emit_shared: bool,
 }
 
 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
@@ -327,6 +320,19 @@ impl Options {
             return Err(0);
         }
 
+        let color = config::parse_color(matches);
+        let config::JsonConfig { json_rendered, json_unused_externs, .. } =
+            config::parse_json(matches);
+        let error_format = config::parse_error_format(matches, color, json_rendered);
+
+        let codegen_options = CodegenOptions::build(matches, error_format);
+        let debugging_opts = DebuggingOptions::build(matches, error_format);
+
+        let diag = new_handler(error_format, None, &debugging_opts);
+
+        // check for deprecated options
+        check_deprecated_options(matches, &diag);
+
         if matches.opt_strs("passes") == ["list"] {
             println!("Available passes for running rustdoc:");
             for pass in passes::PASSES {
@@ -359,19 +365,6 @@ fn println_condition(condition: Condition) {
             return Err(0);
         }
 
-        let color = config::parse_color(matches);
-        let config::JsonConfig { json_rendered, json_unused_externs, .. } =
-            config::parse_json(matches);
-        let error_format = config::parse_error_format(matches, color, json_rendered);
-
-        let codegen_options = CodegenOptions::build(matches, error_format);
-        let debugging_opts = DebuggingOptions::build(matches, error_format);
-
-        let diag = new_handler(error_format, None, &debugging_opts);
-
-        // check for deprecated options
-        check_deprecated_options(matches, &diag);
-
         let mut emit = Vec::new();
         for list in matches.opt_strs("emit") {
             for kind in list.split(',') {
@@ -605,15 +598,6 @@ fn println_condition(condition: Condition) {
 
         let show_coverage = matches.opt_present("show-coverage");
 
-        let default_passes = if matches.opt_present("no-defaults") {
-            passes::DefaultPassOption::None
-        } else if show_coverage {
-            passes::DefaultPassOption::Coverage
-        } else {
-            passes::DefaultPassOption::Default
-        };
-        let manual_passes = matches.opt_strs("passes");
-
         let crate_types = match parse_crate_types_from_list(matches.opt_strs("crate-type")) {
             Ok(types) => types,
             Err(e) => {
@@ -710,8 +694,6 @@ fn println_condition(condition: Condition) {
             lint_cap,
             should_test,
             test_args,
-            default_passes,
-            manual_passes,
             show_coverage,
             crate_version,
             test_run_directory,
@@ -753,6 +735,7 @@ fn println_condition(condition: Condition) {
                 emit,
                 generate_link_to_definition,
                 call_locations,
+                no_emit_shared: false,
             },
             crate_name,
             output_format,
@@ -769,33 +752,38 @@ fn println_condition(condition: Condition) {
 
 /// Prints deprecation warnings for deprecated options
 fn check_deprecated_options(matches: &getopts::Matches, diag: &rustc_errors::Handler) {
-    let deprecated_flags = ["input-format", "no-defaults", "passes"];
+    let deprecated_flags = [];
 
-    for flag in deprecated_flags.iter() {
+    for &flag in deprecated_flags.iter() {
         if matches.opt_present(flag) {
-            let mut err = diag.struct_warn(&format!("the `{}` flag is deprecated", flag));
+            diag.struct_warn(&format!("the `{}` flag is deprecated", flag))
+                .note(
+                    "see issue #44136 <https://github.com/rust-lang/rust/issues/44136> \
+                    for more information",
+                )
+                .emit();
+        }
+    }
+
+    let removed_flags = ["plugins", "plugin-path", "no-defaults", "passes", "input-format"];
+
+    for &flag in removed_flags.iter() {
+        if matches.opt_present(flag) {
+            let mut err = diag.struct_warn(&format!("the `{}` flag no longer functions", flag));
             err.note(
                 "see issue #44136 <https://github.com/rust-lang/rust/issues/44136> \
-                 for more information",
+                for more information",
             );
 
-            if *flag == "no-defaults" {
+            if flag == "no-defaults" || flag == "passes" {
                 err.help("you may want to use --document-private-items");
+            } else if flag == "plugins" || flag == "plugin-path" {
+                err.warn("see CVE-2018-1000622");
             }
 
             err.emit();
         }
     }
-
-    let removed_flags = ["plugins", "plugin-path"];
-
-    for &flag in removed_flags.iter() {
-        if matches.opt_present(flag) {
-            diag.struct_warn(&format!("the '{}' flag no longer functions", flag))
-                .warn("see CVE-2018-1000622")
-                .emit();
-        }
-    }
 }
 
 /// Extracts `--extern-html-root-url` arguments from `matches` and returns a map of crate names to