diff options
| author | Ariel Ben-Yehuda <ariel.byd@gmail.com> | 2016-11-15 23:25:59 +0200 |
|---|---|---|
| committer | Ariel Ben-Yehuda <ariel.byd@gmail.com> | 2016-12-02 00:54:22 +0200 |
| commit | 242cd7ebe295d44c7b612e2e1da8b83412d31f49 (patch) | |
| tree | efd32ff8f3e43532eb32d66e57c676375920885e /src/test/compile-fail | |
| parent | 908dba0c9477b7dd022a236cb1514ddfca9369f2 (diff) | |
| download | rust-242cd7ebe295d44c7b612e2e1da8b83412d31f49.tar.gz rust-242cd7ebe295d44c7b612e2e1da8b83412d31f49.zip | |
limit the length of types in monomorphization
This adds the new insta-stable `#![type_size_limit]` crate attribute to control the limit, and is obviously a [breaking-change] fixable by that.
Diffstat (limited to 'src/test/compile-fail')
| -rw-r--r-- | src/test/compile-fail/issue-22638.rs | 3 | ||||
| -rw-r--r-- | src/test/compile-fail/type_length_limit.rs | 35 |
2 files changed, 37 insertions, 1 deletions
diff --git a/src/test/compile-fail/issue-22638.rs b/src/test/compile-fail/issue-22638.rs index 0c8c2311dca..65d1d837d7d 100644 --- a/src/test/compile-fail/issue-22638.rs +++ b/src/test/compile-fail/issue-22638.rs @@ -10,7 +10,8 @@ #![allow(unused)] -#![recursion_limit = "32"] +#![recursion_limit = "20"] +#![type_length_limit = "20000000"] #[derive(Clone)] struct A (B); diff --git a/src/test/compile-fail/type_length_limit.rs b/src/test/compile-fail/type_length_limit.rs new file mode 100644 index 00000000000..d283f392d76 --- /dev/null +++ b/src/test/compile-fail/type_length_limit.rs @@ -0,0 +1,35 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// error-pattern: reached the type-length limit while instantiating + +// Test that the type length limit can be changed. + +#![allow(dead_code)] +#![type_length_limit="256"] + +macro_rules! link { + ($id:ident, $t:ty) => { + pub type $id = ($t, $t, $t); + } +} + +link! { A, B } +link! { B, C } +link! { C, D } +link! { D, E } +link! { E, F } +link! { F, G } + +pub struct G; + +fn main() { + drop::<Option<A>>(None); +} |
