Prevent rustdoc feature to be passed down to doctests

This commit is contained in:
Guillaume Gomez 2019-09-25 17:08:40 +02:00
parent 42ec6831b0
commit 445e7350f2
3 changed files with 7 additions and 3 deletions

View file

@ -344,7 +344,6 @@ impl Options {
.map(|s| PathBuf::from(&s))
.unwrap_or_else(|| PathBuf::from("doc"));
let mut cfgs = matches.opt_strs("cfg");
cfgs.push("rustdoc".to_string());
if should_test {
cfgs.push("doctest".to_string());
}

View file

@ -234,7 +234,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
error_format,
libs,
externs,
cfgs,
mut cfgs,
codegen_options,
debugging_options,
target,
@ -250,6 +250,9 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
..
} = options;
// Add the rustdoc cfg into the doc build.
cfgs.push("rustdoc".to_string());
let cpath = Some(input.clone());
let input = Input::File(input);

View file

@ -62,9 +62,11 @@ pub fn run(options: Options) -> i32 {
..config::Options::default()
};
let mut cfgs = options.cfgs.clone();
cfgs.push("rustdoc".to_owned());
let config = interface::Config {
opts: sessopts,
crate_cfg: config::parse_cfgspecs(options.cfgs.clone()),
crate_cfg: config::parse_cfgspecs(cfgs),
input,
input_path: None,
output_file: None,