]> git.lizzy.rs Git - rust.git/blob - src/test/ui/regions/regions-infer-static-from-proc.rs
Rollup merge of #97317 - GuillaumeGomez:gui-settings-text-click, r=jsha
[rust.git] / src / test / ui / regions / regions-infer-static-from-proc.rs
1 // run-pass
2 #![allow(non_upper_case_globals)]
3
4 // Check that the 'static bound on a proc influences lifetimes of
5 // region variables contained within (otherwise, region inference will
6 // give `x` a very short lifetime).
7
8 // pretty-expanded FIXME #23616
9
10 static i: usize = 3;
11 fn foo<F:FnOnce()+'static>(_: F) {}
12 fn read(_: usize) { }
13 pub fn main() {
14     let x = &i;
15     foo(move|| {
16         read(*x);
17     });
18 }