]> git.proxmox.com Git - rustc.git/blame - src/test/ui/traits/where-clause-vs-impl.rs
Merge tag 'debian/1.52.1+dfsg1-1_exp2' into proxmox/buster
[rustc.git] / src / test / ui / traits / where-clause-vs-impl.rs
CommitLineData
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
11use std::rc::Rc;
12
13pub trait Foo<M> {
14 fn foo(&mut self, msg: M);
15}
16
17pub trait Bar<M> {
18 fn dummy(&self) -> M;
19}
20
21impl<M, F: Bar<M>> Foo<M> for F {
22 fn foo(&mut self, msg: M) {
23 }
24}
25
26pub struct Both<M, F> {
27 inner: Rc<(M, F)>,
28}
29
30impl<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
36fn repro1<M, F: Foo<M>>(_both: Both<M, F>) {
37}
38
39fn 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
44pub fn main() {
45}