Skip to content

Commit

Permalink
Rollup merge of #81715 - jryans:tab-handling-ice-81614, r=estebank
Browse files Browse the repository at this point in the history
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
  • Loading branch information
m-ou-se authored Feb 3, 2021
2 parents 508b470 + 18f6cc6 commit 65b3c0c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_errors/src/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_errors/src/styled_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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![];
Expand Down

0 comments on commit 65b3c0c

Please sign in to comment.