]> git.lizzy.rs Git - rust.git/blob - tests/ui/dyn-keyword/issue-56327-dyn-trait-in-macro-is-okay.rs
Merge commit '1d8491b120223272b13451fc81265aa64f7f4d5b' into sync-from-rustfmt
[rust.git] / tests / ui / dyn-keyword / issue-56327-dyn-trait-in-macro-is-okay.rs
1 // check-pass
2 // edition:2015
3 //
4 // rust-lang/rust#56327: Some occurrences of `dyn` within a macro are
5 // not instances of identifiers, and thus should *not* be caught by the
6 // keyword_ident lint.
7 //
8 // Otherwise, rustfix replaces the type `Box<dyn Drop>` with
9 // `Box<r#dyn Drop>`, which is injecting a bug rather than fixing
10 // anything.
11
12 #![deny(rust_2018_compatibility)]
13 #![allow(dyn_drop)]
14
15 macro_rules! foo {
16     () => {
17         fn generated_foo() {
18             let _x: Box<dyn Drop>;
19         }
20     }
21 }
22
23 foo!();
24
25 fn main() {
26     generated_foo();
27 }