]>
Commit | Line | Data |
---|---|---|
b7449926 | 1 | // run-pass |
ff7c6d11 XL |
2 | // Regression test for issue #47139: |
3 | // | |
4 | // Same as issue-47139-1.rs, but the impls of dummy are in the | |
5 | // opposite order. This influenced the way that coherence ran and in | |
6 | // some cases caused the overflow to occur when it wouldn't otherwise. | |
7 | // In an effort to make the regr test more robust, I am including both | |
8 | // orderings. | |
9 | ||
10 | #![allow(dead_code)] | |
11 | ||
12 | pub trait Insertable { | |
13 | type Values; | |
14 | ||
15 | fn values(self) -> Self::Values; | |
16 | } | |
17 | ||
18 | impl<T> Insertable for Option<T> | |
19 | where | |
20 | T: Insertable, | |
21 | T::Values: Default, | |
22 | { | |
23 | type Values = T::Values; | |
24 | ||
25 | fn values(self) -> Self::Values { | |
26 | self.map(Insertable::values).unwrap_or_default() | |
27 | } | |
28 | } | |
29 | ||
30 | impl<'a, T> Insertable for &'a Option<T> | |
31 | where | |
32 | Option<&'a T>: Insertable, | |
33 | { | |
34 | type Values = <Option<&'a T> as Insertable>::Values; | |
35 | ||
36 | fn values(self) -> Self::Values { | |
37 | self.as_ref().values() | |
38 | } | |
39 | } | |
40 | ||
41 | impl<'a, T> Insertable for &'a [T] | |
42 | { | |
43 | type Values = Self; | |
44 | ||
45 | fn values(self) -> Self::Values { | |
46 | self | |
47 | } | |
48 | } | |
49 | ||
50 | trait Unimplemented { } | |
51 | ||
52 | trait Dummy { } | |
53 | ||
54 | struct Foo<T> { t: T } | |
55 | ||
56 | impl<T> Dummy for T | |
57 | where T: Unimplemented | |
58 | { } | |
59 | ||
60 | impl<'a, U> Dummy for Foo<&'a U> | |
61 | where &'a U: Insertable | |
62 | { | |
63 | } | |
64 | ||
65 | fn main() { | |
66 | } |