about summary refs log tree commit diff
path: root/tests/ui/issues/issue-32122-2.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/issues/issue-32122-2.rs')
-rw-r--r--tests/ui/issues/issue-32122-2.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/ui/issues/issue-32122-2.rs b/tests/ui/issues/issue-32122-2.rs
new file mode 100644
index 00000000000..39e9df4224e
--- /dev/null
+++ b/tests/ui/issues/issue-32122-2.rs
@@ -0,0 +1,28 @@
+// run-rustfix
+use std::ops::Deref;
+struct Bar(u8);
+struct Foo(Bar);
+struct Emm(Foo);
+impl Deref for Bar{
+    type Target = u8;
+    fn deref(&self) -> &Self::Target {
+        &self.0
+    }
+}
+impl Deref for Foo {
+    type Target = Bar;
+    fn deref(&self) -> &Self::Target {
+        &self.0
+    }
+}
+impl Deref for Emm {
+    type Target = Foo;
+    fn deref(&self) -> &Self::Target {
+        &self.0
+    }
+}
+fn main() {
+    let a = Emm(Foo(Bar(0)));
+    // Should suggest `&***` even when deref is pretty deep
+    let _: *const u8 = &a; //~ ERROR mismatched types
+}