about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2021-02-03 18:51:17 +0100
committerGitHub <noreply@github.com>2021-02-03 18:51:17 +0100
commit65b3c0caf0549efab0ca0ad126d91ffdd7848cd3 (patch)
tree8a3785b4de56164c004c2868e0bd9f13b2106977
parent508b4707ac77dd54dc55d0a2f6195237202d3f3a (diff)
parent18f6cc6c5d50935ed1f549d5545dae91d23de998 (diff)
downloadrust-65b3c0caf0549efab0ca0ad126d91ffdd7848cd3.tar.gz
rust-65b3c0caf0549efab0ca0ad126d91ffdd7848cd3.zip
Rollup merge of #81715 - jryans:tab-handling-ice-81614, r=estebank
Reduce tab formatting assertions to debug only

The tab replacement for diagnostics added in #79757 included a few assertions to ensure all tab characters are handled appropriately. We've started getting reports of these assertions firing (#81614). Since it's only a cosmetic issue, this downgrades the assertions to debug only, so we at least continue compiling even if the diagnostics might be a tad wonky.

Minimizes the impact of #81614
-rw-r--r--compiler/rustc_errors/src/emitter.rs2
-rw-r--r--compiler/rustc_errors/src/styled_buffer.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs
index 00882bb287a..ea62e215230 100644
--- a/compiler/rustc_errors/src/emitter.rs
+++ b/compiler/rustc_errors/src/emitter.rs
@@ -645,7 +645,7 @@ impl EmitterWriter {
         margin: Margin,
     ) {
         // Tabs are assumed to have been replaced by spaces in calling code.
-        assert!(!source_string.contains('\t'));
+        debug_assert!(!source_string.contains('\t'));
         let line_len = source_string.len();
         // Create the source line we will highlight.
         let left = margin.left(line_len);
diff --git a/compiler/rustc_errors/src/styled_buffer.rs b/compiler/rustc_errors/src/styled_buffer.rs
index a4dd0f391bd..ef71ee36ea3 100644
--- a/compiler/rustc_errors/src/styled_buffer.rs
+++ b/compiler/rustc_errors/src/styled_buffer.rs
@@ -15,7 +15,7 @@ impl StyledBuffer {
 
     pub fn render(&self) -> Vec<Vec<StyledString>> {
         // Tabs are assumed to have been replaced by spaces in calling code.
-        assert!(self.text.iter().all(|r| !r.contains(&'\t')));
+        debug_assert!(self.text.iter().all(|r| !r.contains(&'\t')));
 
         let mut output: Vec<Vec<StyledString>> = vec![];
         let mut styled_vec: Vec<StyledString> = vec![];