]>
Commit | Line | Data |
---|---|---|
d9bb1a4e | 1 | // check-pass |
0bf4aa26 | 2 | #![allow(dead_code)] |
c34b1796 AL |
3 | // pretty-expanded FIXME #23616 |
4 | ||
1a4d82fc JJ |
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 | ||
85aaf69f | 21 | struct MyTree<K>(K); |
1a4d82fc JJ |
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() {} |