#![allow(suspicious_auto_trait_impls)] // Tests that we don't incorrectly allow overlap between a builtin auto trait // impl and a user written one. See #83857 for more details struct Always(T, U); unsafe impl Send for Always {} struct Foo(Always); trait False {} unsafe impl Send for Foo {} trait WithAssoc { type Output; } impl WithAssoc for T { type Output = Self; } impl WithAssoc for Foo { type Output = Box; } fn generic(v: Foo, f: fn( as WithAssoc>::Output) -> i32) { //~^ ERROR `Foo` cannot be sent between threads safely f(foo(v)); } fn foo(x: T) -> ::Output { x } fn main() { generic(Foo(Always(0, ())), |b| *b); }