]> git.lizzy.rs Git - rust.git/blob - tests/ui/issues/issue-18906.rs
Auto merge of #107044 - cuviper:more-llvm-ci, r=Mark-Simulacrum
[rust.git] / tests / ui / issues / issue-18906.rs
1 // check-pass
2 #![allow(dead_code)]
3 // pretty-expanded FIXME #23616
4
5 pub trait Borrow<Borrowed: ?Sized> {
6         fn borrow(&self) -> &Borrowed;
7 }
8
9 impl<T: Sized> Borrow<T> for T {
10         fn borrow(&self) -> &T { self }
11 }
12
13 trait Foo {
14         fn foo(&self, other: &Self);
15 }
16
17 fn bar<K, Q>(k: &K, q: &Q) where K: Borrow<Q>, Q: Foo {
18     q.foo(k.borrow())
19 }
20
21 struct MyTree<K>(K);
22
23 impl<K> MyTree<K> {
24     // This caused a failure in #18906
25     fn bar<Q>(k: &K, q: &Q) where K: Borrow<Q>, Q: Foo {
26         q.foo(k.borrow())
27     }
28 }
29
30 fn main() {}