rust/tests
Guillaume Gomez c00192ae2a
Rollup merge of #120460 - nnethercote:fix-120397, r=compiler-errors
Be more careful about interpreting a label/lifetime as a mistyped char literal.

Currently the parser interprets any label/lifetime in certain positions as a mistyped char literal, on the assumption that the trailing single quote was accidentally omitted. In such cases it gives an error with a suggestion to add the trailing single quote, and then puts the appropriate char literal into the AST. This behaviour was introduced in #101293.

This is reasonable for a case like this:
```
let c = 'a;
```
because `'a'` is a valid char literal. It's less reasonable for a case like this:
```
let c = 'abc;
```
because `'abc'` is not a valid char literal.

Prior to #120329 this could result in some sub-optimal suggestions in error messages, but nothing else. But #120329 changed `LitKind::from_token_lit` to assume that the char/byte/string literals it receives are valid, and to assert if not. This is reasonable because the lexer does not produce invalid char/byte/string literals in general. But in this "interpret label/lifetime as unclosed char literal" case the parser can produce an invalid char literal with contents such as `abc`, which triggers an assertion failure.

This PR changes the parser so it's more cautious about interpreting labels/lifetimes as unclosed char literals.

Fixes #120397.

r? `@compiler-errors`
2024-01-30 11:19:19 +01:00
..
assembly Split assembly tests for ELF and MachO 2024-01-25 16:17:35 +01:00
auxiliary
codegen Update codegen test for LLVM 18 2024-01-26 15:03:23 +01:00
codegen-units Adjust compiler tests for unused_tuple_struct_fields -> dead_code 2024-01-02 15:34:37 -05:00
coverage Rollup merge of #120185 - Zalathar:auto-derived, r=wesleywiser 2024-01-24 15:43:12 +01:00
coverage-run-rustdoc coverage: Don't instrument `#[automatically_derived]` functions 2024-01-22 12:18:57 +11:00
debuginfo Update tests. 2024-01-27 16:38:57 +01:00
incremental Track `verbose` and `verbose_internals` 2024-01-20 08:00:09 -05:00
mir-opt Rollup merge of #120424 - RalfJung:raw-ptr-meta, r=Nilstrieb 2024-01-30 11:19:16 +01:00
pretty Add `#[coverage(off)]` to closures introduced by `#[test]`/`#[bench]` 2024-01-21 23:17:00 +11:00
run-make Auto merge of #120062 - davidtwco:llvm-data-layout-check, r=wesleywiser 2024-01-27 12:19:41 +00:00
run-make-fulldeps Auto merge of #118899 - veera-sivarajan:fix-makefile, r=Mark-Simulacrum 2024-01-05 07:42:03 +00:00
run-pass-valgrind
rustdoc Add regression test for #100638 2024-01-29 14:14:03 +01:00
rustdoc-gui Rollup merge of #119746 - notriddle:notriddle/resize-close-modals, r=fmease 2024-01-22 07:56:42 +01:00
rustdoc-js Rollup merge of #118194 - notriddle:notriddle/tuple-unit, r=GuillaumeGomez 2024-01-06 16:07:46 +01:00
rustdoc-js-std Rollup merge of #118194 - notriddle:notriddle/tuple-unit, r=GuillaumeGomez 2024-01-06 16:07:46 +01:00
rustdoc-json Add regression test for `is_object_safe` field on traits 2023-12-23 19:00:17 +01:00
rustdoc-ui Rollup merge of #119730 - vuittont60:master, r=GuillaumeGomez 2024-01-18 20:56:19 +01:00
ui Rollup merge of #120460 - nnethercote:fix-120397, r=compiler-errors 2024-01-30 11:19:19 +01:00
ui-fulldeps Stop using `String` for error codes. 2024-01-29 07:41:41 +11:00
COMPILER_TESTS.md