rust/compiler
Matthias Krüger 665a1a4b55
Rollup merge of #128865 - jieyouxu:unicurd, r=Urgau
Ensure let stmt compound assignment removal suggestion respect codepoint boundaries

Previously we would try to issue a suggestion for `let x <op>= 1`, i.e.
a compound assignment within a `let` binding, to remove the `<op>`. The
suggestion code unfortunately incorrectly assumed that the `<op>` is an
exactly-1-byte ASCII character, but this assumption is incorrect because
we also recover Unicode-confusables like `=` as `-=`. In this example,
the suggestion code used a `+ BytePos(1)` to calculate the span of the
`<op>` codepoint that looks like `-` but the mult-byte Unicode
look-alike would cause the suggested removal span to be inside a
multi-byte codepoint boundary, triggering a codepoint boundary
assertion.

The fix is to use `SourceMap::start_point(token_span)` which properly accounts for codepoint boundaries.

Fixes #128845.

cc #128790

r? ````@fmease````
2024-08-09 18:25:00 +02:00
..
2024-07-29 08:26:52 +10:00
2024-07-29 08:26:52 +10:00
2024-07-31 03:29:10 +00:00
2024-08-08 21:51:50 +02:00
2024-07-29 08:26:52 +10:00
2024-07-29 08:26:52 +10:00
2024-07-29 08:26:52 +10:00
2024-07-29 08:26:52 +10:00
2024-07-30 10:22:48 +02:00
2024-07-29 08:26:52 +10:00
2024-07-29 08:26:52 +10:00
2024-07-29 08:26:52 +10:00
2024-07-29 08:26:52 +10:00
2024-07-29 08:26:52 +10:00
2024-08-07 00:43:56 -04:00
2024-07-29 08:26:52 +10:00
2024-07-29 08:26:52 +10:00