rust/compiler/rustc_errors
Matthias Krüger 52ce43e9ac
Rollup merge of #124370 - ShE3py:substitution-part-offset, r=fee1-dead
Fix substitution parts having a shifted underline in some cases

If two suggestions parts are side by side, the underline's offset:
(WIP PR as an example, not yet pushed)
```
error: expected a pattern, found an expression
 --> ./main.rs:4:9
  |
4 |         1 + 2 => 3
  |         ^^^^^ arbitrary expressions are not allowed in patterns
  |
help: check the value in an arm guard
  |
4 |         n if n == 1 + 2 => 3
  |         ~     +++++++++++++
```
The emitter didn't take into account that the string had shrunk/grown if two substitution parts were side-by-side (surprisingly, there was only one case in the ui testsuite.)

```
help: check the value in an arm guard
  |
4 |         n if n == 1 + 2 => 3
  |         ~ +++++++++++++
```

``@rustbot`` label +A-suggestion-diagnostics
2024-04-27 20:46:07 +02:00
..
src Rollup merge of #124370 - ShE3py:substitution-part-offset, r=fee1-dead 2024-04-27 20:46:07 +02:00
Cargo.toml windows bump to 0.52 2024-02-18 16:02:16 +03:00
messages.ftl Implement diagnostic translation for expected lifetime parameter message 2023-07-07 15:56:01 +09:00