//@ check-pass #![allow(dead_code)] //@ pretty-expanded FIXME #23616 pub trait Borrow { fn borrow(&self) -> &Borrowed; } impl Borrow for T { fn borrow(&self) -> &T { self } } trait Foo { fn foo(&self, other: &Self); } fn bar(k: &K, q: &Q) where K: Borrow, Q: Foo { q.foo(k.borrow()) } struct MyTree(K); impl MyTree { // This caused a failure in #18906 fn bar(k: &K, q: &Q) where K: Borrow, Q: Foo { q.foo(k.borrow()) } } fn main() {}