rust-analyzer/crates/syntax/src
Matthias Krüger 3ec86f1978
Rollup merge of #119172 - nnethercote:earlier-NulInCStr, r=petrochenkov
Detect `NulInCStr` error earlier.

By making it an `EscapeError` instead of a `LitError`. This makes it like the other errors produced when checking string literals contents, e.g. for invalid escape sequences or bare CR chars.

NOTE: this means these errors are issued earlier, before expansion, which changes behaviour. It will be possible to move the check back to the later point if desired. If that happens, it's likely that all the string literal contents checks will be delayed together.

One nice thing about this: the old approach had some code in `report_lit_error` to calculate the span of the nul char from a range. This code used a hardwired `+2` to account for the `c"` at the start of a C string literal, but this should have changed to a `+3` for raw C string literals to account for the `cr"`, which meant that the caret in `cr"` nul error messages was one short of where it should have been. The new approach doesn't need any of this and avoids the off-by-one error.

r? ```@fee1-dead```
2024-01-18 10:34:17 +01:00
..
ast Auto merge of #16275 - davidsemakula:ast-path-segments, r=Veykril 2024-01-09 15:41:48 +00:00
parsing Replace ID based TokenMap with proper relative text-ranges / spans 2023-11-28 10:55:39 +01:00
tests Merge commit '3b7c7f97e4a7bb253a8d398ee4f8346f6cf2817b' into sync-from-ra 2023-11-08 08:15:03 +02:00
validation Add semicolons for consistency 2021-10-03 23:39:43 +11:00
algo.rs ⬆️ rust-analyzer 2023-01-09 10:36:22 -08:00
ast.rs Add inlay hint for exclusive ranges 2024-01-07 09:33:56 +00:00
fuzz.rs ⬆️ rust-analyzer 2023-01-09 10:36:22 -08:00
hacks.rs ⬆️ rust-analyzer 2023-01-09 10:36:22 -08:00
lib.rs Split out rustc_lexer from rustc_dependencies 2024-01-08 15:24:46 +01:00
parsing.rs dead code 2021-12-28 19:13:30 +03:00
ptr.rs fix: Smaller spans for unresolved field and method diagnostics 2023-12-08 18:46:36 +01:00
syntax_error.rs Run cargo fix --edition-idioms 2022-07-20 15:02:08 +02:00
syntax_node.rs ⬆️ rust-analyzer 2023-02-13 13:55:14 +02:00
ted.rs ⬆️ rust-analyzer 2023-01-09 10:36:22 -08:00
tests.rs Replace ID based TokenMap with proper relative text-ranges / spans 2023-11-28 10:55:39 +01:00
token_text.rs Implicit format args support 2023-12-05 17:07:00 +01:00
utils.rs Simplify and improve perf of import_assets::import_for_item 2023-12-12 11:35:34 +01:00
validation.rs Rollup merge of #119172 - nnethercote:earlier-NulInCStr, r=petrochenkov 2024-01-18 10:34:17 +01:00