1 // Copyright 2016 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.
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.
11 // This test case tests whether we can handle code bases that contain a high
12 // number of closures, something that needs special handling in the MingGW
14 // See https://github.com/rust-lang/rust/issues/34793 for more information.
16 // Expand something exponentially
17 macro_rules! go_bacterial {
18 ($mac:ident) => ($mac!());
19 ($mac:ident 1 $($t:tt)*) => (
20 go_bacterial!($mac $($t)*);
21 go_bacterial!($mac $($t)*);
25 macro_rules! mk_closure {
27 let c = |a: u32| a + 4;
37 go_bacterial!(mk_closure 1 1 1 1);
45 // Make 2^12 functions, each containing 16 closures,
46 // resulting in 2^16 closures overall.
47 go_bacterial!(mk_fn 1 1 1 1 1 1 1 1 1 1 1 1);