fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1// run-rustfix 2use std::ops::Deref; 3 4trait Happy {} 5struct LDM; 6impl Happy for &LDM {} 7 8struct Foo(LDM); 9struct Bar(Foo); 10struct Baz(Bar); 11impl Deref for Foo { 12 type Target = LDM; 13 fn deref(&self) -> &Self::Target { 14 &self.0 15 } 16} 17impl Deref for Bar { 18 type Target = Foo; 19 fn deref(&self) -> &Self::Target { 20 &self.0 21 } 22} 23impl Deref for Baz { 24 type Target = Bar; 25 fn deref(&self) -> &Self::Target { 26 &self.0 27 } 28} 29 30fn foo<T>(_: T) where T: Happy {} 31 32fn main() { 33 let baz = Baz(Bar(Foo(LDM))); 34 foo(&***baz); 35 //~^ ERROR the trait bound `&Baz: Happy` is not satisfied 36}