]> git.lizzy.rs Git - rust.git/blob - tests/ui/where-clauses/where-for-self-2.rs
Don't resolve type var roots in point_at_expr_source_of_inferred_type
[rust.git] / tests / ui / where-clauses / where-for-self-2.rs
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
3 // specific lifetime is not enough to satisfy the `for<'a> ...` constraint, which
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)
17 where
18     for<'a> &'a T: Bar,
19 {
20 }
21
22 fn main() {
23     foo(&X); //~ ERROR implementation of `Bar` is not general enough
24 }