]> git.proxmox.com Git - rustc.git/blob - src/test/compile-fail/recursion_limit.rs
Imported Upstream version 1.9.0+dfsg1
[rustc.git] / src / test / compile-fail / recursion_limit.rs
1 // Copyright 2014 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
11 // Test that the recursion limit can be changed. In this case, we have
12 // deeply nested types that will fail the `Send` check by overflow
13 // when the recursion limit is set very low.
14
15 #![allow(dead_code)]
16 #![recursion_limit="10"]
17
18 macro_rules! link {
19 ($id:ident, $t:ty) => {
20 enum $id { $id($t) }
21 }
22 }
23
24 link! { A, B }
25 link! { B, C }
26 link! { C, D }
27 link! { D, E }
28 link! { E, F }
29 link! { F, G }
30 link! { G, H }
31 link! { H, I }
32 link! { I, J }
33 link! { J, K }
34 link! { K, L }
35 link! { L, M }
36 link! { M, N }
37
38 enum N { N(usize) }
39
40 fn is_send<T:Send>() { }
41
42 fn main() {
43 is_send::<A>();
44 //~^ ERROR overflow evaluating
45 //~| NOTE consider adding a `#![recursion_limit="20"]` attribute to your crate
46 //~| NOTE required because it appears within the type `A`
47 //~| NOTE required because it appears within the type `B`
48 //~| NOTE required because it appears within the type `C`
49 //~| NOTE required because it appears within the type `D`
50 //~| NOTE required because it appears within the type `E`
51 //~| NOTE required because it appears within the type `F`
52 //~| NOTE required because it appears within the type `G`
53 //~| NOTE required because it appears within the type `H`
54 //~| NOTE required because it appears within the type `I`
55 //~| NOTE required because it appears within the type `J`
56 //~| NOTE required by `is_send`
57 }