Skip to content

Commit 95ee1fc

Browse files
Correctly detect color support
1 parent fd4a33c commit 95ee1fc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/librustdoc/doctest.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -428,11 +428,13 @@ crate fn make_test(
428428
// Any errors in parsing should also appear when the doctest is compiled for real, so just
429429
// send all the errors that librustc_ast emits directly into a `Sink` instead of stderr.
430430
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
431+
supports_color =
432+
EmitterWriter::stderr(ColorConfig::Auto, None, false, false, Some(80), false)
433+
.supports_color();
434+
431435
let emitter =
432436
EmitterWriter::new(box io::sink(), None, false, false, false, None, false);
433437

434-
supports_color = emitter.supports_color();
435-
436438
// FIXME(misdreavus): pass `-Z treat-err-as-bug` to the doctest parser
437439
let handler = Handler::with_emitter(false, None, box emitter);
438440
let sess = ParseSess::with_span_handler(handler, sm);

0 commit comments

Comments
 (0)