summaryrefslogtreecommitdiffstats
path: root/src/tools/rustfmt/tests/target/dyn_trait.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/rustfmt/tests/target/dyn_trait.rs')
-rw-r--r--src/tools/rustfmt/tests/target/dyn_trait.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/tools/rustfmt/tests/target/dyn_trait.rs b/src/tools/rustfmt/tests/target/dyn_trait.rs
new file mode 100644
index 000000000..b6e2810a5
--- /dev/null
+++ b/src/tools/rustfmt/tests/target/dyn_trait.rs
@@ -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;
+}