about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authory21 <30553356+y21@users.noreply.github.com>2023-06-14 16:52:02 +0200
committery21 <30553356+y21@users.noreply.github.com>2023-06-14 16:52:02 +0200
commit2ba192695527b1633f63396b3e12bbbdf7b19fef (patch)
tree924545dbc93e2ca6ac59f6d65d5173ae913f128b /tests
parenta3b185b60ae14e4aa6091606ae2ea0d9d18be93f (diff)
downloadrust-2ba192695527b1633f63396b3e12bbbdf7b19fef.tar.gz
rust-2ba192695527b1633f63396b3e12bbbdf7b19fef.zip
[`derivable_impls`]: don't lint if expr unsize-coerces
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/derivable_impls.fixed21
-rw-r--r--tests/ui/derivable_impls.rs21
2 files changed, 42 insertions, 0 deletions
diff --git a/tests/ui/derivable_impls.fixed b/tests/ui/derivable_impls.fixed
index aa0efb85c29..a10f3d01070 100644
--- a/tests/ui/derivable_impls.fixed
+++ b/tests/ui/derivable_impls.fixed
@@ -268,4 +268,25 @@ impl Default for OtherGenericType {
     }
 }
 
+mod issue10158 {
+    pub trait T {}
+
+    #[derive(Default)]
+    pub struct S {}
+    impl T for S {}
+
+    pub struct Outer {
+        pub inner: Box<dyn T>,
+    }
+
+    impl Default for Outer {
+        fn default() -> Self {
+            Outer {
+                // Box::<S>::default() adjusts to Box<dyn T>
+                inner: Box::<S>::default(),
+            }
+        }
+    }
+}
+
 fn main() {}
diff --git a/tests/ui/derivable_impls.rs b/tests/ui/derivable_impls.rs
index 8dc999ad586..18cef1c5be8 100644
--- a/tests/ui/derivable_impls.rs
+++ b/tests/ui/derivable_impls.rs
@@ -304,4 +304,25 @@ impl Default for OtherGenericType {
     }
 }
 
+mod issue10158 {
+    pub trait T {}
+
+    #[derive(Default)]
+    pub struct S {}
+    impl T for S {}
+
+    pub struct Outer {
+        pub inner: Box<dyn T>,
+    }
+
+    impl Default for Outer {
+        fn default() -> Self {
+            Outer {
+                // Box::<S>::default() adjusts to Box<dyn T>
+                inner: Box::<S>::default(),
+            }
+        }
+    }
+}
+
 fn main() {}