diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2023-06-16 14:46:17 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-16 14:46:17 +0530 |
| commit | c2e109744db3322f44ebfbe707847bbb9b9be933 (patch) | |
| tree | f728efaf54e915d106a8042fb302b33588d94c48 /tests | |
| parent | 2c850691c11d3400c08ba9680a000d8d1cc2eae6 (diff) | |
| parent | 9ef580fa6f2b5019b35e6a9cf979f6f13d21de00 (diff) | |
| download | rust-c2e109744db3322f44ebfbe707847bbb9b9be933.tar.gz rust-c2e109744db3322f44ebfbe707847bbb9b9be933.zip | |
Rollup merge of #112642 - compiler-errors:interp-lit-err, r=nnethercote
Handle interpolated literal errors Not sure why it was doing a whole dance to re-match on the token kind when it seems like `Lit::from_token` does the right thing for both macro-arg and regular literals. Nothing seems to have regressed diagnostics-wise from the change, though. Fixes #112622 r? ``@nnethercote``
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/parser/lit-err-in-macro.rs | 10 | ||||
| -rw-r--r-- | tests/ui/parser/lit-err-in-macro.stderr | 8 |
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/parser/lit-err-in-macro.rs b/tests/ui/parser/lit-err-in-macro.rs new file mode 100644 index 00000000000..cff8ee6b40c --- /dev/null +++ b/tests/ui/parser/lit-err-in-macro.rs @@ -0,0 +1,10 @@ +macro_rules! f { + ($abi:literal) => { + extern $abi fn f() {} + } +} + +f!("Foo"__); +//~^ ERROR suffixes on string literals are invalid + +fn main() {} diff --git a/tests/ui/parser/lit-err-in-macro.stderr b/tests/ui/parser/lit-err-in-macro.stderr new file mode 100644 index 00000000000..a61fb5c85d4 --- /dev/null +++ b/tests/ui/parser/lit-err-in-macro.stderr @@ -0,0 +1,8 @@ +error: suffixes on string literals are invalid + --> $DIR/lit-err-in-macro.rs:7:4 + | +LL | f!("Foo"__); + | ^^^^^^^ invalid suffix `__` + +error: aborting due to previous error + |
