about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2019-03-27 17:18:49 +0100
committerFelix S. Klock II <pnkfelix@pnkfx.org>2019-03-27 17:18:49 +0100
commit1f63a52ca26ac2a59591a1b23e8d2c73baff5d6b (patch)
tree1a6e7fa69432f5ba686ccc215338d8825d24904e
parent6d7e5df3d92fcb5f67a790dfc56acec2a33170d3 (diff)
downloadrust-1f63a52ca26ac2a59591a1b23e8d2c73baff5d6b.tar.gz
rust-1f63a52ca26ac2a59591a1b23e8d2c73baff5d6b.zip
Regression test for rust-lang/rust#56327.
-rw-r--r--src/test/ui/dyn-keyword/issue-56327-dyn-trait-in-macro-is-okay.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/ui/dyn-keyword/issue-56327-dyn-trait-in-macro-is-okay.rs b/src/test/ui/dyn-keyword/issue-56327-dyn-trait-in-macro-is-okay.rs
new file mode 100644
index 00000000000..ff3830d6175
--- /dev/null
+++ b/src/test/ui/dyn-keyword/issue-56327-dyn-trait-in-macro-is-okay.rs
@@ -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();
+}