Skip to content

Commit 5644bf7

Browse files
committed
Pass the error message format to rustdoc
Goes with rust-lang/rust#81675. Will help with rust-lang/rust#81662.
1 parent 537dc09 commit 5644bf7

File tree

1 file changed

+11
-0
lines changed
  • src/cargo/core/compiler/context

1 file changed

+11
-0
lines changed

src/cargo/core/compiler/context/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
214214
let mut unstable_opts = false;
215215
let mut args = compiler::extern_args(&self, unit, &mut unstable_opts)?;
216216
args.extend(compiler::lto_args(&self, unit));
217+
217218
for feature in &unit.features {
218219
args.push("--cfg".into());
219220
args.push(format!("feature=\"{}\"", feature).into());
@@ -228,6 +229,16 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
228229
}
229230
}
230231
args.extend(self.bcx.rustdocflags_args(unit).iter().map(Into::into));
232+
233+
use super::MessageFormat;
234+
let format = match self.bcx.build_config.message_format {
235+
MessageFormat::Short => "short",
236+
MessageFormat::Human => "human",
237+
MessageFormat::Json { .. } => "json",
238+
};
239+
args.push("--error-format".into());
240+
args.push(format.into());
241+
231242
self.compilation.to_doc_test.push(compilation::Doctest {
232243
unit: unit.clone(),
233244
args,

0 commit comments

Comments
 (0)