about summary refs log tree commit diff
path: root/tests/codegen/src-hash-algorithm
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-01-18 10:34:17 +0100
committerGitHub <noreply@github.com>2024-01-18 10:34:17 +0100
commit7d4980a4d81091908a1c28b4c6e8a0037a441534 (patch)
tree7bda9982fc7259865f5797243c76ba6b8de772bd /tests/codegen/src-hash-algorithm
parent6bbd106c70370ca6a78de0676f103810f9eea22a (diff)
parent6001c50cac411d7a889c4dfd176d6dda8b4b181f (diff)
downloadrust-7d4980a4d81091908a1c28b4c6e8a0037a441534.tar.gz
rust-7d4980a4d81091908a1c28b4c6e8a0037a441534.zip
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```
Diffstat (limited to 'tests/codegen/src-hash-algorithm')
0 files changed, 0 insertions, 0 deletions