Skip to content

Commit

Permalink
Pass the error message format to rustdoc
Browse files Browse the repository at this point in the history
Goes with rust-lang/rust#81675.

Will help with rust-lang/rust#81662.
  • Loading branch information
poliorcetics committed Feb 3, 2021
1 parent 537dc09 commit 5644bf7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/cargo/core/compiler/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
let mut unstable_opts = false;
let mut args = compiler::extern_args(&self, unit, &mut unstable_opts)?;
args.extend(compiler::lto_args(&self, unit));

for feature in &unit.features {
args.push("--cfg".into());
args.push(format!("feature=\"{}\"", feature).into());
Expand All @@ -228,6 +229,16 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
}
}
args.extend(self.bcx.rustdocflags_args(unit).iter().map(Into::into));

use super::MessageFormat;
let format = match self.bcx.build_config.message_format {
MessageFormat::Short => "short",
MessageFormat::Human => "human",
MessageFormat::Json { .. } => "json",
};
args.push("--error-format".into());
args.push(format.into());

self.compilation.to_doc_test.push(compilation::Doctest {
unit: unit.clone(),
args,
Expand Down

0 comments on commit 5644bf7

Please sign in to comment.