]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/recursion_limit.rs
rollup merge of #20608: nikomatsakis/assoc-types-method-dispatch
[rust.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 #![feature(macro_rules)]
16 #![allow(dead_code)]
17 #![recursion_limit="10"]
18
19 macro_rules! link {
20     ($id:ident, $t:ty) => {
21         enum $id { $id($t) }
22     }
23 }
24
25 link! { A, B }
26 link! { B, C }
27 link! { C, D }
28 link! { D, E }
29 link! { E, F }
30 link! { F, G }
31 link! { G, H }
32 link! { H, I }
33 link! { I, J }
34 link! { J, K }
35 link! { K, L }
36 link! { L, M }
37 link! { M, N }
38
39 enum N { N(uint) }
40
41 fn is_send<T:Send>() { }
42
43 fn main() {
44     is_send::<A>();
45     //~^ ERROR overflow evaluating
46     //~^^ NOTE consider adding a `#![recursion_limit="20"]` attribute to your crate
47     //~^^^ NOTE required by `is_send`
48     //~^^^^ ERROR overflow evaluating
49     //~^^^^^ NOTE consider adding a `#![recursion_limit="20"]` attribute to your crate
50     //~^^^^^^ NOTE required by `is_send`
51 }