]> git.proxmox.com Git - rustc.git/blob - tests/ui/regions/regions-static-bound-rpass.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / regions / regions-static-bound-rpass.rs
1 // run-pass
2
3 fn invariant_id<'a,'b>(t: &'b mut &'static ()) -> &'b mut &'a ()
4 where 'a: 'static { t }
5 //~^ WARN unnecessary lifetime parameter `'a`
6
7 fn static_id<'a>(t: &'a ()) -> &'static ()
8 where 'a: 'static { t }
9 //~^ WARN unnecessary lifetime parameter `'a`
10
11 fn static_id_indirect<'a,'b>(t: &'a ()) -> &'static ()
12 where 'a: 'b, 'b: 'static { t }
13 //~^ WARN unnecessary lifetime parameter `'b`
14
15 fn ref_id<'a>(t: &'a ()) -> &'a () where 'static: 'a { t }
16
17 static UNIT: () = ();
18
19 fn main()
20 {
21 let mut val : &'static () = &UNIT;
22 invariant_id(&mut val);
23 static_id(val);
24 static_id_indirect(val);
25 ref_id(val);
26 }