trait UnsafeCopy<'a, T: Copy> where for<'b> >::Item: std::ops::Deref, { type Item; fn bug(item: &Self::Item) -> () { let x: T = **item; &x as *const _; } } impl UnsafeCopy<'_, T> for T { type Item = T; //~^ ERROR type mismatch resolving `::Target == T` } pub fn main() { <&'static str>::bug(&""); //~^ ERROR type mismatch resolving `<&str as Deref>::Target == &str` }