]> git.proxmox.com Git - rustc.git/blame - src/test/ui/regions/regions-infer-not-param.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / regions / regions-infer-not-param.rs
CommitLineData
0731742a 1struct Direct<'a> {
1a4d82fc 2 f: &'a isize
223e47cc
LB
3}
4
0731742a 5struct Indirect1 {
223e47cc 6 // Here the lifetime parameter of direct is bound by the fn()
dc9dc135 7 g: Box<dyn FnOnce(Direct) + 'static>
223e47cc
LB
8}
9
0731742a 10struct Indirect2<'a> {
1a4d82fc 11 // But here it is set to 'a
dc9dc135 12 g: Box<dyn FnOnce(Direct<'a>) + 'static>
223e47cc
LB
13}
14
04454e1e 15fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p }
923072b8 16//~^ ERROR lifetime may not live long enough
1a4d82fc 17
0731742a 18fn take_indirect1(p: Indirect1) -> Indirect1 { p }
1a4d82fc 19
04454e1e 20fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p }
923072b8
FG
21//~^ ERROR lifetime may not live long enough
22//~| ERROR lifetime may not live long enough
1a4d82fc 23
223e47cc 24fn main() {}