]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-32122-2.rs
Rollup merge of #91804 - woppopo:const_clone, r=oli-obk
[rust.git] / src / test / ui / issues / issue-32122-2.rs
1 // run-rustfix
2 use std::ops::Deref;
3 struct Bar(u8);
4 struct Foo(Bar);
5 struct Emm(Foo);
6 impl Deref for Bar{
7     type Target = u8;
8     fn deref(&self) -> &Self::Target {
9         &self.0
10     }
11 }
12 impl Deref for Foo {
13     type Target = Bar;
14     fn deref(&self) -> &Self::Target {
15         &self.0
16     }
17 }
18 impl Deref for Emm {
19     type Target = Foo;
20     fn deref(&self) -> &Self::Target {
21         &self.0
22     }
23 }
24 fn main() {
25     let a = Emm(Foo(Bar(0)));
26     // Should suggest `&***` even when deref is pretty deep
27     let _: *const u8 = &a; //~ ERROR mismatched types
28 }