forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regression test for rust-lang#56327.
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/test/ui/dyn-keyword/issue-56327-dyn-trait-in-macro-is-okay.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// compile-pass | ||
|
||
// rust-lang/rust#56327: Some occurrences of `dyn` within a macro are | ||
// not instances of identifiers, and thus should *not* be caught by the | ||
// keyword_ident lint. | ||
// | ||
// Otherwise, rustfix replaces the type `Box<dyn Drop>` with | ||
// `Box<r#dyn Drop>`, which is injecting a bug rather than fixing | ||
// anything. | ||
|
||
#![deny(rust_2018_compatibility)] | ||
|
||
macro_rules! foo { | ||
() => { | ||
fn generated_foo() { | ||
let _x: Box<dyn Drop>; | ||
} | ||
} | ||
} | ||
|
||
foo!(); | ||
|
||
fn main() { | ||
generated_foo(); | ||
} |