From 63785c839d03532a9b8f99e1dd588b6b544e5026 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 13 Nov 2020 11:19:39 +0100 Subject: [PATCH] Add comment explaining why we can't split on `error[{}]: ` because of the color escape characters --- src/librustdoc/doctest.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index 3f62dead33a..05f841a7be0 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -336,6 +336,9 @@ fn run_test( (true, false) => {} (false, true) => { if !error_codes.is_empty() { + // We used to check if the output contained "error[{}]: " but since we added the + // colored output, we can't anymore because of the color escape characters before + // the ":". error_codes.retain(|err| !out.contains(&format!("error[{}]", err))); if !error_codes.is_empty() {