2023-04-29 07:57:26 -05:00
|
|
|
#![feature(builtin_syntax)]
|
|
|
|
|
2023-04-22 09:29:34 -05:00
|
|
|
// For the exposed macro we already test these errors in the other files,
|
|
|
|
// but this test helps to make sure the builtin construct also errors.
|
|
|
|
// This has the same examples as offset-of-arg-count.rs
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
builtin # offset_of(NotEnoughArguments); //~ ERROR expected one of
|
|
|
|
}
|
|
|
|
fn t1() {
|
2024-01-02 16:12:35 -06:00
|
|
|
builtin # offset_of(NotEnoughArgumentsWithAComma, ); //~ ERROR expected expression
|
2023-04-22 09:29:34 -05:00
|
|
|
}
|
|
|
|
fn t2() {
|
2024-01-02 16:12:35 -06:00
|
|
|
builtin # offset_of(S, f, too many arguments); //~ ERROR expected `)`, found `too`
|
2023-04-22 09:29:34 -05:00
|
|
|
}
|
|
|
|
fn t3() {
|
|
|
|
builtin # offset_of(S, f); // compiles fine
|
|
|
|
}
|
|
|
|
fn t4() {
|
2024-01-02 16:12:35 -06:00
|
|
|
builtin # offset_of(S, f.); //~ ERROR unexpected token
|
2023-04-22 09:29:34 -05:00
|
|
|
}
|
|
|
|
fn t5() {
|
2024-01-02 16:12:35 -06:00
|
|
|
builtin # offset_of(S, f.,); //~ ERROR unexpected token
|
2023-04-22 09:29:34 -05:00
|
|
|
}
|
|
|
|
fn t6() {
|
2024-01-02 16:12:35 -06:00
|
|
|
builtin # offset_of(S, f..); //~ ERROR offset_of expects dot-separated field and variant names
|
2023-04-22 09:29:34 -05:00
|
|
|
}
|
|
|
|
fn t7() {
|
2024-01-02 16:12:35 -06:00
|
|
|
builtin # offset_of(S, f..,); //~ ERROR offset_of expects dot-separated field and variant names
|
2023-04-22 09:29:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
struct S { f: u8, }
|