]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-49934.rs
Merge commit '97e504549371d7640cf011d266e3c17394fdddac' into sync_cg_clif-2021-12-20
[rust.git] / src / test / ui / issues / issue-49934.rs
1 #![feature(stmt_expr_attributes)]
2
3 fn main() {
4     // fold_stmt (Item)
5     #[allow(dead_code)]
6     #[derive(Debug)] // should not warn
7     struct Foo;
8
9     // fold_stmt (Mac)
10     #[derive(Debug)] //~ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s
11     println!("Hello, world!");
12
13     // fold_stmt (Semi)
14     #[derive(Debug)] //~ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s
15     "Hello, world!";
16
17     // fold_stmt (Local)
18     #[derive(Debug)] //~ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s
19     let _ = "Hello, world!";
20
21     // visit_expr
22     let _ = #[derive(Debug)] "Hello, world!";
23     //~^ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s
24
25     let _ = [
26         // filter_map_expr
27         #[derive(Debug)] //~ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s
28         "Hello, world!",
29     ];
30 }