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."
10 #![allow(non_camel_case_types)]
11 #![deny(keyword_idents)]
15 //~^ ERROR `dyn` is a keyword
16 //~| WARN this is accepted in the current edition
18 //~^ ERROR `dyn` is a keyword
19 //~| WARN this is accepted in the current edition
22 use outer_mod::r#dyn::r#dyn;
23 //~^ ERROR `dyn` is a keyword
24 //~| WARN this is accepted in the current edition
25 //~| ERROR `dyn` is a keyword
26 //~| WARN this is accepted in the current edition
29 match r#dyn { r#dyn => {} }
30 //~^ ERROR `dyn` is a keyword
31 //~| WARN this is accepted in the current edition
32 //~| ERROR `dyn` is a keyword
33 //~| WARN this is accepted in the current edition
35 //~^ ERROR `dyn` is a keyword
36 //~| WARN this is accepted in the current edition
45 //~^ ERROR `dyn` is a keyword
46 //~| WARN this is accepted in the current edition
48 // Note that we do not lint nor fix occurrences under macros
49 ($dyn:tt) => { (Box<dyn Trait>, Box<$dyn Trait>) }
52 pub fn r#dyn() -> ::outer_mod::r#dyn::r#dyn {
53 //~^ ERROR `dyn` is a keyword
54 //~| WARN this is accepted in the current edition
55 //~| ERROR `dyn` is a keyword
56 //~| WARN this is accepted in the current edition
57 //~| ERROR `dyn` is a keyword
58 //~| WARN this is accepted in the current edition
59 ::outer_mod::r#dyn::r#dyn
60 //~^ ERROR `dyn` is a keyword
61 //~| WARN this is accepted in the current edition
62 //~| ERROR `dyn` is a keyword
63 //~| WARN this is accepted in the current edition
68 pub fn boxed() -> r#dyn!(
69 //~^ ERROR `dyn` is a keyword
70 //~| WARN this is accepted in the current edition
72 // Note that we do not lint nor fix occurrences under macros
76 (Box::new(1), Box::new(2))
82 impl Trait for u32 { }