]> git.proxmox.com Git - rustc.git/blame - src/test/ui/regions/regions-early-bound-error-method.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / regions / regions-early-bound-error-method.rs
CommitLineData
1a4d82fc
JJ
1// Tests that you can use a fn lifetime parameter as part of
2// the value for a type parameter in a bound.
223e47cc 3
1a4d82fc
JJ
4trait GetRef<'a> {
5 fn get(&self) -> &'a isize;
223e47cc
LB
6}
7
1a4d82fc
JJ
8struct Box<'a> {
9 t: &'a isize
223e47cc
LB
10}
11
1a4d82fc
JJ
12impl<'a> GetRef<'a> for Box<'a> {
13 fn get(&self) -> &'a isize {
14 self.t
223e47cc
LB
15 }
16}
17
1a4d82fc
JJ
18impl<'a> Box<'a> {
19 fn or<'b,G:GetRef<'b>>(&self, g2: G) -> &'a isize {
85aaf69f 20 g2.get()
923072b8 21 //~^ ERROR lifetime may not live long enough
223e47cc
LB
22 }
23}
24
25fn main() {
223e47cc 26}