]> git.lizzy.rs Git - rust.git/blob - src/test/ui/regions/regions-static-bound.rs
Rollup merge of #57107 - mjbshaw:thread_local_test, r=nikomatsakis
[rust.git] / src / test / ui / regions / regions-static-bound.rs
1 // revisions: ll nll
2 //[nll] compile-flags:-Zborrowck=mir
3
4 fn static_id<'a,'b>(t: &'a ()) -> &'static ()
5     where 'a: 'static { t }
6 fn static_id_indirect<'a,'b>(t: &'a ()) -> &'static ()
7     where 'a: 'b, 'b: 'static { t }
8 fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
9     t //[ll]~ ERROR E0312
10         //[nll]~^ ERROR unsatisfied lifetime constraints
11 }
12
13 fn error(u: &(), v: &()) {
14     static_id(&u); //[ll]~ ERROR explicit lifetime required in the type of `u` [E0621]
15     //[nll]~^ ERROR explicit lifetime required in the type of `u` [E0621]
16     static_id_indirect(&v); //[ll]~ ERROR explicit lifetime required in the type of `v` [E0621]
17     //[nll]~^ ERROR explicit lifetime required in the type of `v` [E0621]
18 }
19
20 fn main() {}