1
Fork 0

Correctly detect color support

This commit is contained in:
Guillaume Gomez 2020-11-12 22:32:42 +01:00
parent fd4a33cbbe
commit 95ee1fc7ea

View file

@ -428,11 +428,13 @@ crate fn make_test(
// Any errors in parsing should also appear when the doctest is compiled for real, so just
// send all the errors that librustc_ast emits directly into a `Sink` instead of stderr.
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
supports_color =
EmitterWriter::stderr(ColorConfig::Auto, None, false, false, Some(80), false)
.supports_color();
let emitter =
EmitterWriter::new(box io::sink(), None, false, false, false, None, false);
supports_color = emitter.supports_color();
// FIXME(misdreavus): pass `-Z treat-err-as-bug` to the doctest parser
let handler = Handler::with_emitter(false, None, box emitter);
let sess = ParseSess::with_span_handler(handler, sm);