]> git.lizzy.rs Git - rust.git/blob - src/test/ui/regions/regions-early-bound-error-method.rs
Auto merge of #106143 - matthiaskrgr:rollup-3kpy1dc, r=matthiaskrgr
[rust.git] / src / test / ui / regions / regions-early-bound-error-method.rs
1 // Tests that you can use a fn lifetime parameter as part of
2 // the value for a type parameter in a bound.
3
4 trait GetRef<'a> {
5     fn get(&self) -> &'a isize;
6 }
7
8 struct Box<'a> {
9     t: &'a isize
10 }
11
12 impl<'a> GetRef<'a> for Box<'a> {
13     fn get(&self) -> &'a isize {
14         self.t
15     }
16 }
17
18 impl<'a> Box<'a> {
19     fn or<'b,G:GetRef<'b>>(&self, g2: G) -> &'a isize {
20         g2.get()
21         //~^ ERROR lifetime may not live long enough
22     }
23 }
24
25 fn main() {
26 }