]> git.lizzy.rs Git - rust.git/blob - tests/ui/trait-bounds/impl-missing-where-clause-lifetimes-from-trait.rs
Rollup merge of #106813 - oli-obk:sess_cleanup, r=GuillaumeGomez,petrochenkov
[rust.git] / tests / ui / trait-bounds / impl-missing-where-clause-lifetimes-from-trait.rs
1 trait Trait<T> {
2     fn foo<'a, K>(self, _: T, _: K) where T: 'a, K: 'a;
3 }
4
5 impl Trait<()> for () {
6     fn foo<'a, K>(self, _: (), _: K) where { //~ ERROR E0195
7         todo!();
8     }
9 }
10
11 struct State;
12
13 trait Foo<T> {
14     fn foo<'a>(&self, state: &'a State) -> &'a T
15     where
16         T: 'a;
17 }
18
19 impl<F, T> Foo<T> for F
20 where
21     F: Fn(&State) -> &T,
22 {
23     fn foo<'a>(&self, state: &'a State) -> &'a T { //~ ERROR E0195
24         self(state)
25     }
26 }
27
28 trait Bar {
29     fn foo<'a>(&'a self) {}
30 }
31
32 impl Bar for () {
33     fn foo<'a: 'a>(&'a self) {} //~ ERROR E0195
34 }
35
36 fn main() {
37     ().foo((), ());
38 }