]> git.proxmox.com Git - rustc.git/blobdiff - src/tools/rustfmt/tests/target/dyn_trait.rs
New upstream version 1.52.1+dfsg1
[rustc.git] / src / tools / rustfmt / tests / target / dyn_trait.rs
diff --git a/src/tools/rustfmt/tests/target/dyn_trait.rs b/src/tools/rustfmt/tests/target/dyn_trait.rs
new file mode 100644 (file)
index 0000000..b6e2810
--- /dev/null
@@ -0,0 +1,27 @@
+#![feature(dyn_trait)]
+
+fn main() {
+    // #2506
+    // checks rustfmt doesn't remove dyn
+    trait MyTrait {
+        fn method(&self) -> u64;
+    }
+    fn f1(a: Box<dyn MyTrait>) {}
+
+    // checks if line wrap works correctly
+    trait Very_______________________Long__________________Name_______________________________Trait
+    {
+        fn method(&self) -> u64;
+    }
+
+    fn f2(
+        a: Box<
+            dyn Very_______________________Long__________________Name____________________Trait
+                + 'static,
+        >,
+    ) {
+    }
+
+    // #2582
+    let _: &dyn (::std::any::Any) = &msg;
+}