rust/compiler/rustc_errors/src
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
..
json Make JsonEmitter more like HumanEmitter. 2024-02-29 17:50:26 +11:00
markdown constify a couple thread_local statics 2024-02-12 16:25:39 +01:00
annotate_snippet_emitter_writer.rs Rename DiagnosticMessage as DiagMessage. 2024-03-05 12:14:49 +11:00
codes.rs Stop using String for error codes. 2024-01-29 07:41:41 +11:00
diagnostic_impls.rs Move "elided lifetime in path" to subdiagnostic struct 2024-04-21 07:45:03 +00:00
diagnostic.rs Pass translation closure to add_to_diag_with() as reference 2024-04-21 07:45:03 +00:00
emitter.rs Fix substitution parts having a shifted underline in some cases 2024-04-25 13:09:13 +02:00
error.rs Minor visibility and formatting improvements. 2024-02-29 16:30:09 +11:00
json.rs If suggestion would leave an empty line, delete it 2024-03-01 13:48:20 +00:00
lib.rs Format stash message correctly 2024-04-25 10:03:17 -04:00
lock.rs windows bump to 0.52 2024-02-18 16:02:16 +03:00
registry.rs Stop using String for error codes. 2024-01-29 07:41:41 +11:00
snippet.rs Rework StringPart. 2024-02-01 19:23:01 +11:00
styled_buffer.rs Replace some _ == _ || _ == _s with matches!(_, _ | _)s 2023-01-30 12:26:26 +00:00
tests.rs Rename DiagnosticMessage as DiagMessage. 2024-03-05 12:14:49 +11:00
translation.rs Rename DiagnosticMessage as DiagMessage. 2024-03-05 12:14:49 +11:00