]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-49934.rs
Rollup merge of #53326 - memoryruins:issue-27868-test, r=nikomatsakis
[rust.git] / src / test / ui / issues / issue-49934.rs
1 // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // compile-pass
12
13 #![feature(stmt_expr_attributes)]
14 #![warn(unused_attributes)] //~ NOTE lint level defined here
15
16 fn foo<#[derive(Debug)] T>() { //~ WARN unused attribute
17     match 0 {
18         #[derive(Debug)] //~ WARN unused attribute
19         _ => (),
20     }
21 }
22
23 fn main() {
24     // fold_stmt (Item)
25     #[allow(dead_code)]
26     #[derive(Debug)] // should not warn
27     struct Foo;
28
29     // fold_stmt (Mac)
30     #[derive(Debug)]
31     //~^ WARN `#[derive]` does nothing on macro invocations
32     //~| NOTE this may become a hard error in a future release
33     println!("Hello, world!");
34
35     // fold_stmt (Semi)
36     #[derive(Debug)] //~ WARN unused attribute
37     "Hello, world!";
38
39     // fold_stmt (Local)
40     #[derive(Debug)] //~ WARN unused attribute
41     let _ = "Hello, world!";
42
43     // fold_expr
44     let _ = #[derive(Debug)] "Hello, world!";
45     //~^ WARN unused attribute
46
47     let _ = [
48         // fold_opt_expr
49         #[derive(Debug)] //~ WARN unused attribute
50         "Hello, world!"
51     ];
52 }