]> git.proxmox.com Git - rustc.git/blame - src/test/run-pass/regions-infer-static-from-proc.rs
Imported Upstream version 1.0.0~beta
[rustc.git] / src / test / run-pass / regions-infer-static-from-proc.rs
CommitLineData
1a4d82fc 1// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
223e47cc
LB
2// file at the top-level directory of this distribution and at
3// http://rust-lang.org/COPYRIGHT.
4//
5// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8// option. This file may not be copied, modified, or distributed
9// except according to those terms.
10
1a4d82fc
JJ
11// Check that the 'static bound on a proc influences lifetimes of
12// region variables contained within (otherwise, region inference will
13// give `x` a very short lifetime).
223e47cc 14
c34b1796
AL
15// pretty-expanded FIXME #23616
16
17static i: usize = 3;
1a4d82fc 18fn foo<F:FnOnce()+'static>(_: F) {}
c34b1796 19fn read(_: usize) { }
1a4d82fc
JJ
20pub fn main() {
21 let x = &i;
22 foo(move|| {
23 read(*x);
24 });
223e47cc 25}