mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Test invalid tuple field identifiers
This commit is contained in:
parent
731601ccd1
commit
d722f27684
10
tests/ui/offset-of/offset-of-tuple.rs
Normal file
10
tests/ui/offset-of/offset-of-tuple.rs
Normal 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
|
||||
}
|
37
tests/ui/offset-of/offset-of-tuple.stderr
Normal file
37
tests/ui/offset-of/offset-of-tuple.stderr
Normal 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`.
|
Loading…
Reference in New Issue
Block a user