Skip to content

Commit

Permalink
Propagate custom cfg directives to rustdoc, fixes rust-lang#1980
Browse files Browse the repository at this point in the history
  • Loading branch information
gkoz committed Oct 11, 2015
1 parent 1860455 commit 807da6b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/cargo/ops/cargo_rustc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,17 @@ fn rustdoc(cx: &mut Context, unit: &Unit) -> CargoResult<Work> {
}

let name = unit.pkg.name().to_string();
let desc = rustdoc.to_string();
let build_state = cx.build_state.clone();
let key = (unit.pkg.package_id().clone(), unit.kind);
let exec_engine = cx.exec_engine.clone();

Ok(Work::new(move |desc_tx| {
desc_tx.send(desc).unwrap();
if let Some(output) = build_state.outputs.lock().unwrap().get(&key) {
for cfg in output.cfgs.iter() {
rustdoc.arg("--cfg").arg(cfg);
}
}
desc_tx.send(rustdoc.to_string()).unwrap();
exec_engine.exec(rustdoc).chain_error(|| {
human(format!("Could not document `{}`.", name))
})
Expand Down

0 comments on commit 807da6b

Please sign in to comment.