Test invalid tuple field identifiers

This commit is contained in:
clubby789 2023-06-02 01:29:39 +00:00
parent 731601ccd1
commit d722f27684
2 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,10 @@
#![feature(offset_of)]
#![feature(builtin_syntax)]
fn main() {
core::mem::offset_of!((u8, u8), _0); //~ ERROR no field `_0`
core::mem::offset_of!((u8, u8), +1); //~ ERROR no rules expected
core::mem::offset_of!((u8, u8), -1); //~ ERROR no rules expected
builtin # offset_of((u8, u8), _0); //~ ERROR no field `_0`
builtin # offset_of((u8, u8), +1); //~ ERROR expected identifier
}

View File

@ -0,0 +1,37 @@
error: expected identifier, found `+`
--> $DIR/offset-of-tuple.rs:9:35
|
LL | builtin # offset_of((u8, u8), +1);
| ^ expected identifier
error: no rules expected the token `1`
--> $DIR/offset-of-tuple.rs:6:38
|
LL | core::mem::offset_of!((u8, u8), +1);
| ^ no rules expected this token in macro call
|
= note: while trying to match sequence start
error: no rules expected the token `1`
--> $DIR/offset-of-tuple.rs:7:38
|
LL | core::mem::offset_of!((u8, u8), -1);
| ^ no rules expected this token in macro call
|
= note: while trying to match sequence start
error[E0609]: no field `_0` on type `(u8, u8)`
--> $DIR/offset-of-tuple.rs:5:37
|
LL | core::mem::offset_of!((u8, u8), _0);
| ^^
error[E0609]: no field `_0` on type `(u8, u8)`
--> $DIR/offset-of-tuple.rs:8:35
|
LL | builtin # offset_of((u8, u8), _0);
| ^^
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0609`.