Change:
In my Fedora installation ended up being a corrupted file. It took me hours to realize, given that the output does not bring any clarity to it. rustc should really have ratelimit detection or something to detect corrupted file instead and inform about this to the user. !
This indeed seems quite confusing; and counter-productive to try to show this blob of errors. Would you be able to provide us with a reproducible example of the issue? Or if you still have it the corrupted file. labels +T-compiler +A-diagnostics +D-verbose +D-confusing +S-needs-repro -needs-triage
So this a problem because I unfortunately deleted the trashed file before someone told me that I should report this as a bug. I regret that I did not store it :-/ BUT I recalled that it was probably for reason a long string of ANSI escape codes. So I did a test string: This creates somewhat similar output as I got, except probably the string was a bit longer in my case.
OK doubling that starts to be almost perfect match:
! ... I'm considering T-shirt design ;-) Made by me and rustc. EDIT: and rendered by excellent terminal emulator foot
Somehow rustc should be able to detect corrupted file in cargo's source repository (or whatever it is called). It was pretty bizarre sight when I encountered this by accident.
Thanks for the repro. label -S-needs-repro
Yeah I mean it is really a huge corner case but it can happen in the case of data corruption (e.g. power outage in middle of write operation). I'd detect frequency of errors and maybe a threshold parameter when it is interpreted as corruption with a sane default value.
yeah, I believe this error comes out from the phase of lexing, which rustc are trying to find all the mismatched delimiters, maybe a threshold is ok for resolve it.

Discussion:
fn eof_err(&mut self) -> PErr<'psess> { let msg = "this file contains an unclosed delimiter"; let mut err = self.string_reader.dcx().struct_span_err(self.token.span, msg); <del> for &(_, sp) in &self.diag_info.open_braces { err.span_label(sp, "unclosed delimiter"); </del> <ins> let unclosed_delimiter_show_limit = 5; let len = usize::min(unclosed_delimiter_show_limit, self.diag_info.open_braces.len()); for &(_, span) in &self.diag_info.open_braces[..len] { err.span_label(span, "unclosed delimiter"); </ins> self.diag_info.unmatched_delims.push(UnmatchedDelim { found_delim: None, found_span: self.token.span, <del> unclosed_span: Some(sp), </del> <ins> unclosed_span: Some(span), </ins> candidate_span: None, }); } <ins> if let Some((_, span)) = self.diag_info.open_braces.get(unclosed_delimiter_show_limit) && self.diag_info.open_braces.len() >= unclosed_delimiter_show_limit + 2 { err.span_label( *span, format!( "another {} unclosed delimiters begin from here", self.diag_info.open_braces.len() - unclosed_delimiter_show_limit ), ); } </ins> if let Some((delim, _)) = self.diag_info.open_braces.last() { report_suspicious_mismatch_block( &mut err,

|          - unclosed delimiter ... LL | fn foo() { <del> |          - unclosed delimiter ... LL | fn bar() { |          - unclosed delimiter </del> <ins> |          - another 3 unclosed delimiters begin from here </ins> ... <del> LL | fn baz() { |          - unclosed delimiter LL |     if false { </del> LL |         { |         - this delimiter might not be properly closed... LL |             && let () = ()

<ins> // issue: rust-lang/rust#127868 fn main() { let a = [[[[[[[[[[[[[[[[[[[[1, {, (, [,; } //~ ERROR mismatched closing delimiter: `}` //~ ERROR this file contains an unclosed delimiter </ins>

<ins> error: mismatched closing delimiter: `}` --> $DIR/mismatched-delimiter-corner-case-issue-127868.rs:4:42 | LL | fn main() { |           - closing delimiter possibly meant for this LL |     let a = [[[[[[[[[[[[[[[[[[[[1, {, (, [,; |                                          ^ unclosed delimiter LL | } | ^ mismatched closing delimiter error: this file contains an unclosed delimiter --> $DIR/mismatched-delimiter-corner-case-issue-127868.rs:6:52 | LL | fn main() { |           - unclosed delimiter LL |     let a = [[[[[[[[[[[[[[[[[[[[1, {, (, [,; |             -----                  - this delimiter might not be properly closed... |             ||||| |             ||||another 16 unclosed delimiters begin from here |             |||unclosed delimiter |             ||unclosed delimiter |             |unclosed delimiter |             unclosed delimiter LL | } | - ...as it matches this but it has different indentation LL | |                                                   ^ error: aborting due to 2 previous errors </ins>