diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index f2682e00430d..af5c95ea5899 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -254,10 +254,11 @@ impl Options { (instead was `{}`)", arg)); } }; + // FIXME: deduplicate this code from the identical code in librustc/session/config.rs let error_format = match matches.opt_str("error-format").as_ref().map(|s| &s[..]) { Some("human") => ErrorOutputType::HumanReadable(color), - Some("json") => ErrorOutputType::Json(false), - Some("pretty-json") => ErrorOutputType::Json(true), + Some("json") => ErrorOutputType::Json { pretty: false, colorful_rendered: false }, + Some("pretty-json") => ErrorOutputType::Json { pretty: true, colorful_rendered: false }, Some("short") => ErrorOutputType::Short(color), None => ErrorOutputType::HumanReadable(color), Some(arg) => { diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 3cf6b32b07c4..18bb5eef538b 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -307,7 +307,7 @@ pub fn new_handler(error_format: ErrorOutputType, sessopts.debugging_opts.teach, ).ui_testing(ui_testing) ), - ErrorOutputType::Json(pretty) => { + ErrorOutputType::Json { pretty, colorful_rendered } => { let source_map = source_map.unwrap_or_else( || Lrc::new(source_map::SourceMap::new(sessopts.file_path_mapping()))); Box::new( @@ -315,6 +315,7 @@ pub fn new_handler(error_format: ErrorOutputType, None, source_map, pretty, + colorful_rendered, ).ui_testing(ui_testing) ) }, diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 0bbc7c5c4b22..abf74158c938 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -381,7 +381,7 @@ pub fn make_test(s: &str, // Any errors in parsing should also appear when the doctest is compiled for real, so just // send all the errors that libsyntax emits directly into a `Sink` instead of stderr. let cm = Lrc::new(SourceMap::new(FilePathMapping::empty())); - let emitter = EmitterWriter::new(box io::sink(), None, false, false); + let emitter = EmitterWriter::new(box io::sink(), None, false, false, false); let handler = Handler::with_emitter(false, None, box emitter); let sess = ParseSess::with_span_handler(handler, cm);