]>
Commit | Line | Data |
---|---|---|
b7449926 | 1 | // run-pass |
0bf4aa26 XL |
2 | #![allow(dead_code)] |
3 | #![allow(unused_variables)] | |
1a4d82fc JJ |
4 | // Test that when there is a conditional (but blanket) impl and a |
5 | // where clause, we don't get confused in trait resolution. | |
6 | // | |
7 | // Issue #18453. | |
8 | ||
c34b1796 AL |
9 | // pretty-expanded FIXME #23616 |
10 | ||
1a4d82fc JJ |
11 | use std::rc::Rc; |
12 | ||
13 | pub trait Foo<M> { | |
14 | fn foo(&mut self, msg: M); | |
15 | } | |
16 | ||
17 | pub trait Bar<M> { | |
18 | fn dummy(&self) -> M; | |
19 | } | |
20 | ||
21 | impl<M, F: Bar<M>> Foo<M> for F { | |
22 | fn foo(&mut self, msg: M) { | |
23 | } | |
24 | } | |
25 | ||
26 | pub struct Both<M, F> { | |
27 | inner: Rc<(M, F)>, | |
28 | } | |
29 | ||
30 | impl<M, F: Foo<M>> Clone for Both<M, F> { | |
31 | fn clone(&self) -> Both<M, F> { | |
32 | Both { inner: self.inner.clone() } | |
33 | } | |
34 | } | |
35 | ||
36 | fn repro1<M, F: Foo<M>>(_both: Both<M, F>) { | |
37 | } | |
38 | ||
39 | fn repro2<M, F: Foo<M>>(msg: M, foo: F) { | |
40 | let both = Both { inner: Rc::new((msg, foo)) }; | |
41 | repro1(both.clone()); // <--- This clone causes problem | |
42 | } | |
43 | ||
44 | pub fn main() { | |
45 | } |