diff options
| author | Jieyou Xu <jieyouxu@outlook.com> | 2025-08-15 22:41:43 +0800 |
|---|---|---|
| committer | Jieyou Xu <jieyouxu@outlook.com> | 2025-08-18 21:57:10 +0800 |
| commit | eb3441b25a7acbce8cec0571b3f8ec87cca8c349 (patch) | |
| tree | 4b41d32e44ff480c2332d466c8b6d588e4dce67e /tests/ui/parser/tuple-index-suffix-proc-macro.rs | |
| parent | d7f7443a9540761c7cc2540c4b7b07b31b6120e5 (diff) | |
| download | rust-eb3441b25a7acbce8cec0571b3f8ec87cca8c349.tar.gz rust-eb3441b25a7acbce8cec0571b3f8ec87cca8c349.zip | |
Add test coverage for proc-macro invalid tup index suffixes
Diffstat (limited to 'tests/ui/parser/tuple-index-suffix-proc-macro.rs')
| -rw-r--r-- | tests/ui/parser/tuple-index-suffix-proc-macro.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/ui/parser/tuple-index-suffix-proc-macro.rs b/tests/ui/parser/tuple-index-suffix-proc-macro.rs new file mode 100644 index 00000000000..feca6f9cdfb --- /dev/null +++ b/tests/ui/parser/tuple-index-suffix-proc-macro.rs @@ -0,0 +1,31 @@ +//! See #59418. +//! +//! Like `tuple-index-suffix.rs`, but exercises the proc-macro interaction. + +//@ proc-macro: tuple-index-suffix-proc-macro-aux.rs + +extern crate tuple_index_suffix_proc_macro_aux; +use tuple_index_suffix_proc_macro_aux as aux; + +fn main() { + struct TupStruct(i32); + let tup_struct = TupStruct(42); + + // #60186 carve outs `{i,u}{32,usize}` as non-lint pseudo-FCW warnings. + + aux::bad_tup_indexing!(0usize); + //~^ WARN suffixes on a tuple index are invalid + aux::bad_tup_struct_indexing!(tup_struct, 0isize); + //~^ WARN suffixes on a tuple index are invalid + + // Not part of the #60186 carve outs. + + aux::bad_tup_indexing!(0u8); + //~^ ERROR suffixes on a tuple index are invalid + aux::bad_tup_struct_indexing!(tup_struct, 0u64); + //~^ ERROR suffixes on a tuple index are invalid + + // NOTE: didn't bother with trying to figure out how to generate `struct P { 0u32: u32 }` using + // *only* `proc_macro` without help with `syn`/`quote`, looks like you can't with just + // `proc_macro::quote`? +} |
