1 // Under the 2015 edition with the keyword_idents lint, `dyn` is not
2 // entirely acceptable as an identifier. We currently do not attempt
3 // to detect or fix uses of `dyn` under a macro. Since we are testing
4 // this file via `rustfix`, we want the rustfix output to be
5 // compilable; so the macros here carefully use `dyn` "correctly."
9 #![allow(non_camel_case_types)]
10 #![deny(keyword_idents)]
14 //~^ ERROR `dyn` is a keyword
15 //~| WARN was previously accepted
17 //~^ ERROR `dyn` is a keyword
18 //~| WARN was previously accepted
21 use outer_mod::dyn::dyn;
22 //~^ ERROR `dyn` is a keyword
23 //~| WARN was previously accepted
24 //~| ERROR `dyn` is a keyword
25 //~| WARN was previously accepted
28 match dyn { dyn => {} }
29 //~^ ERROR `dyn` is a keyword
30 //~| WARN was previously accepted
31 //~| ERROR `dyn` is a keyword
32 //~| WARN was previously accepted
34 //~^ ERROR `dyn` is a keyword
35 //~| WARN was previously accepted
44 //~^ ERROR `dyn` is a keyword
45 //~| WARN was previously accepted
47 // Note that we do not lint nor fix occurrences under macros
48 ($dyn:tt) => { (Box<dyn Trait>, Box<$dyn Trait>) }
51 pub fn dyn() -> ::outer_mod::dyn::dyn {
52 //~^ ERROR `dyn` is a keyword
53 //~| WARN was previously accepted
54 //~| ERROR `dyn` is a keyword
55 //~| WARN was previously accepted
56 //~| ERROR `dyn` is a keyword
57 //~| WARN was previously accepted
59 //~^ ERROR `dyn` is a keyword
60 //~| WARN was previously accepted
61 //~| ERROR `dyn` is a keyword
62 //~| WARN was previously accepted
67 pub fn boxed() -> dyn!(
68 //~^ ERROR `dyn` is a keyword
69 //~| WARN was previously accepted
71 // Note that we do not lint nor fix occurrences under macros
75 (Box::new(1), Box::new(2))
81 impl Trait for u32 { }