fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1// run-rustfix 2use std::ops::Deref; 3struct Bar(u8); 4struct Foo(Bar); 5struct Emm(Foo); 6impl Deref for Bar{ 7 type Target = u8; 8 fn deref(&self) -> &Self::Target { 9 &self.0 10 } 11} 12impl Deref for Foo { 13 type Target = Bar; 14 fn deref(&self) -> &Self::Target { 15 &self.0 16 } 17} 18impl Deref for Emm { 19 type Target = Foo; 20 fn deref(&self) -> &Self::Target { 21 &self.0 22 } 23} 24fn 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}