about summary refs log tree commit diff
path: root/tests/ui/parser/tuple-index-suffix-proc-macro.rs
blob: 2463897381ec2a01f4d4b7618cf607ead037fac5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//! See #59418.
//!
//! Like `tuple-index-suffix.rs`, but exercises the proc-macro interaction.

//@ proc-macro: tuple-index-suffix-proc-macro-aux.rs
//@ ignore-backends: gcc

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);

    // Previously, #60186 had carve outs for `{i,u}{32,usize}` as non-lint pseudo-FCW warnings. Now,
    // they all hard error.

    aux::bad_tup_indexing!(0usize);
    //~^ ERROR suffixes on a tuple index are invalid
    aux::bad_tup_struct_indexing!(tup_struct, 0isize);
    //~^ ERROR 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`?
}