X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustdoc%2Fconfig.rs;h=56b40d8c66baffa627ab03e1a9b83788b73d276d;hb=d112cd9a00aa757fd5d285c009a31b918eef3883;hp=41af4f9561b53b0c34e1524f0bebdc7e8fec3790;hpb=6ccd14a782420d27aef9d9fcd9196949a3276427;p=rust.git diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 41af4f9561b..56b40d8c66b 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -69,8 +69,10 @@ pub(crate) struct Options { pub(crate) input: PathBuf, /// The name of the crate being documented. pub(crate) crate_name: Option, - /// The types of the crate being documented. - pub(crate) crate_types: Vec, + /// Whether or not this is a bin crate + pub(crate) bin_crate: bool, + /// Whether or not this is a proc-macro crate + pub(crate) proc_macro_crate: bool, /// How to format errors and warnings. pub(crate) error_format: ErrorOutputType, /// Width of output buffer to truncate errors appropriately. @@ -176,7 +178,8 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Options") .field("input", &self.input) .field("crate_name", &self.crate_name) - .field("crate_types", &self.crate_types) + .field("bin_crate", &self.bin_crate) + .field("proc_macro_crate", &self.proc_macro_crate) .field("error_format", &self.error_format) .field("libs", &self.libs) .field("externs", &FmtExterns(&self.externs)) @@ -667,6 +670,8 @@ fn println_condition(condition: Condition) { None => OutputFormat::default(), }; let crate_name = matches.opt_str("crate-name"); + let bin_crate = crate_types.contains(&CrateType::Executable); + let proc_macro_crate = crate_types.contains(&CrateType::ProcMacro); let playground_url = matches.opt_str("playground-url"); let maybe_sysroot = matches.opt_str("sysroot").map(PathBuf::from); let module_sorting = if matches.opt_present("sort-modules-by-appearance") { @@ -717,7 +722,8 @@ fn println_condition(condition: Condition) { rustc_feature::UnstableFeatures::from_environment(crate_name.as_deref()); let options = Options { input, - crate_types, + bin_crate, + proc_macro_crate, error_format, diagnostic_width, libs,