use std::ops::Deref; struct DerefWithHelper { pub helper: H, pub value: Option } trait Helper { fn helper_borrow(&self) -> &T; } impl Helper for Option { fn helper_borrow(&self) -> &T { self.as_ref().unwrap() } } impl> Deref for DerefWithHelper { type Target = T; fn deref(&self) -> &T { self.helper.helper_borrow() } } // Test cross-crate autoderef + vtable. pub fn check(x: T, y: T) -> bool { let d: DerefWithHelper, T> = DerefWithHelper { helper: Some(x), value: None }; d.eq(&y) }