Change:
<!-- Thank you for finding an Internal Compiler Error! If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples. --code is from clippy: :warning: you need rustc build with debug assertions :warning: <!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details
Run into this while fuzzing, here is a minimized test case: Note that you need rustc with debug assertions enabled. Reproduced in nightly 2022-02-25.
Another test case:
OP and seem to be fixed on latest master (). now outputs "Span must not be empty and have no suggestion" <details<summarybacktrace</summary</details
I can confirm that both of my examples have been fixed on latest master () so this issue can be closed.

Discussion:
// Colorize addition/replacements with green. for &SubstitutionHighlight { start, end } in highlight_parts { <del> // Account for tabs when highlighting (#87972). let tabs: usize = line_to_add .chars() .take(start) .map(|ch| match ch { 't' => 3, _ => 0, }) .sum(); buffer.set_style_range( *row_num, max_line_num_len + 3 + start + tabs, max_line_num_len + 3 + end + tabs, Style::Addition, true, ); </del> <ins> // This is a no-op for empty ranges if start != end { // Account for tabs when highlighting (#87972). let tabs: usize = line_to_add .chars() .take(start) .map(|ch| match ch { 't' => 3, _ => 0, }) .sum(); buffer.set_style_range( *row_num, max_line_num_len + 3 + start + tabs, max_line_num_len + 3 + end + tabs, Style::Addition, true, ); } </ins> } *row_num += 1; }

}); buf.push_str(&part.snippet); let cur_hi = sm.lookup_char_pos(part.span.hi()); <del> if cur_hi.line == cur_lo.line && !part.snippet.is_empty() { // Account for the difference between the width of the current code and the // snippet being suggested, so that the *later* suggestions are correctly // aligned on the screen. acc += len - (cur_hi.col.0 - cur_lo.col.0) as isize; } </del> <ins> // Account for the difference between the width of the current code and the // snippet being suggested, so that the *later* suggestions are correctly // aligned on the screen. Note that cur_hi and cur_lo can be on different // lines, so cur_hi.col can be smaller than cur_lo.col acc += len - (cur_hi.col.0 as isize - cur_lo.col.0 as isize); </ins> prev_hi = cur_hi; prev_line = sf.get_line(prev_hi.line - 1); for line in part.snippet.split('n').skip(1) {

<ins> fn generate_setter() { String::with_capacity( //~^ ERROR this function takes 1 argument but 3 arguments were supplied generate_setter, r#" pub(crate) struct Person<T: Clone> {} "#, r#""#, ); } fn main() {} </ins>

<ins> error[E0061]: this function takes 1 argument but 3 arguments were supplied --> $DIR/issue-109854.rs:2:5 | LL |       String::with_capacity( |       ^^^^^^^^^^^^^^^^^^^^^ ... LL | /     r#" LL | | pub(crate) struct Person<T: Clone> {} LL | | "#, | |__- unexpected argument of type `&'static str` LL |        r#""#, |        ----- unexpected argument of type `&'static str` | note: expected `usize`, found fn item --> $DIR/issue-109854.rs:4:5 | LL |     generate_setter, |     ^^^^^^^^^^^^^^^ = note: expected type `usize` found fn item `fn() {generate_setter}` note: associated function defined here --> $SRC_DIR/alloc/src/string.rs:LL:COL help: remove the extra arguments | LL -     generate_setter, LL +     /* usize */, | error: aborting due to previous error For more information about this error, try `rustc --explain E0061`. </ins>

<ins> fn L(]{match (; {` //~^^ ERROR mismatched closing delimiter //~^^ ERROR unknown start of token //~ ERROR this file contains an unclosed delimiter </ins>

<ins> error: unknown start of token: ` --> $DIR/issue-94171.rs:2:5 | LL | (; {` |     ^ | help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not | LL | (; {' |     ~ error: mismatched closing delimiter: `]` --> $DIR/issue-94171.rs:1:5 | LL | fn L(]{match |     ^^ mismatched closing delimiter |     | |     unclosed delimiter error: this file contains an unclosed delimiter --> $DIR/issue-94171.rs:5:52 | LL | fn L(]{match |      -- unclosed delimiter |      | |      missing open `[` for this delimiter LL | (; {` | -  - unclosed delimiter | | | unclosed delimiter ... LL | |                                                    ^ error: aborting due to 3 previous errors </ins>