summaryrefslogtreecommitdiffstats
path: root/tests/ui/issues/issue-71676-2.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/issues/issue-71676-2.rs')
-rw-r--r--tests/ui/issues/issue-71676-2.rs42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/ui/issues/issue-71676-2.rs b/tests/ui/issues/issue-71676-2.rs
new file mode 100644
index 000000000..f3183899d
--- /dev/null
+++ b/tests/ui/issues/issue-71676-2.rs
@@ -0,0 +1,42 @@
+use std::ops::Deref;
+use std::ops::DerefMut;
+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
+ }
+}
+impl DerefMut for Bar{
+ fn deref_mut(&mut self) -> &mut Self::Target {
+ &mut self.0
+ }
+}
+impl DerefMut for Foo {
+ fn deref_mut(&mut self) -> &mut Self::Target {
+ &mut self.0
+ }
+}
+impl DerefMut for Emm {
+ fn deref_mut(&mut self) -> &mut Self::Target {
+ &mut self.0
+ }
+}
+fn main() {
+ let a = Emm(Foo(Bar(0)));
+ let _: *mut u8 = &a; //~ ERROR mismatched types
+}