]> git.proxmox.com Git - rustc.git/blame - src/test/compile-fail/regions-nested-fns.rs
Imported Upstream version 1.9.0+dfsg1
[rustc.git] / src / test / compile-fail / regions-nested-fns.rs
CommitLineData
223e47cc
LB
1// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
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
c34b1796 11// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
1a4d82fc 12
223e47cc
LB
13fn ignore<T>(t: T) {}
14
1a4d82fc 15fn nested<'x>(x: &'x isize) {
223e47cc 16 let y = 3;
54a0048b 17 let mut ay = &y; //~ ERROR E0495
223e47cc 18
c34b1796 19 ignore::<Box<for<'z> FnMut(&'z isize)>>(Box::new(|z| {
54a0048b 20 ay = x;
970d7e83 21 ay = &y;
223e47cc 22 ay = z;
c34b1796 23 }));
223e47cc 24
c34b1796 25 ignore::< Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
54a0048b 26 if false { return x; } //~ ERROR E0312
223e47cc
LB
27 if false { return ay; }
28 return z;
c34b1796 29 }));
223e47cc
LB
30}
31
32fn main() {}