]>
Commit | Line | Data |
---|---|---|
85aaf69f SL |
1 | // Test that we can quantify lifetimes outside a constraint (i.e., including |
2 | // the self type) in a where clause. Specifically, test that implementing for a | |
b7449926 | 3 | // specific lifetime is not enough to satisfy the `for<'a> ...` constraint, which |
85aaf69f SL |
4 | // should require *all* lifetimes. |
5 | ||
6 | static X: &'static u32 = &42; | |
7 | ||
8 | trait Bar { | |
9 | fn bar(&self); | |
10 | } | |
11 | ||
12 | impl Bar for &'static u32 { | |
13 | fn bar(&self) {} | |
14 | } | |
15 | ||
16 | fn foo<T>(x: &T) | |
f035d41b XL |
17 | where |
18 | for<'a> &'a T: Bar, | |
19 | { | |
20 | } | |
85aaf69f SL |
21 | |
22 | fn main() { | |
f035d41b | 23 | foo(&X); //~ ERROR implementation of `Bar` is not general enough |
85aaf69f | 24 | } |