diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2016-03-28 19:21:10 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2016-04-04 11:14:44 -0400 |
| commit | 944723b7731ec1eacdbc1946009bcd51d17a6301 (patch) | |
| tree | 6a5e97c79c0bdbef93a496a711d3484bc7527e84 /src/test | |
| parent | f92ce2e9fe56942e0fd6a18d0e11bc4a9bdf8ddd (diff) | |
| download | rust-944723b7731ec1eacdbc1946009bcd51d17a6301.tar.gz rust-944723b7731ec1eacdbc1946009bcd51d17a6301.zip | |
process cycles as soon as they are detected
We used to wait for the recursion limit, but that might well be too long!
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/issue-32326.rs | 20 | ||||
| -rw-r--r-- | src/test/compile-fail/sized-cycle-note.rs | 10 |
2 files changed, 25 insertions, 5 deletions
diff --git a/src/test/compile-fail/issue-32326.rs b/src/test/compile-fail/issue-32326.rs new file mode 100644 index 00000000000..8af243afc22 --- /dev/null +++ b/src/test/compile-fail/issue-32326.rs @@ -0,0 +1,20 @@ +// Copyright 2012 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. + +// Regression test for #32326. We ran out of memory because we +// attempted to expand this case up to the recursion limit, and 2^N is +// too big. + +enum Expr { //~ ERROR E0072 + Plus(Expr, Expr), + Literal(i64), +} + +fn main() { } diff --git a/src/test/compile-fail/sized-cycle-note.rs b/src/test/compile-fail/sized-cycle-note.rs index ec378d05ba5..3d7c4868e96 100644 --- a/src/test/compile-fail/sized-cycle-note.rs +++ b/src/test/compile-fail/sized-cycle-note.rs @@ -20,11 +20,11 @@ struct Baz { q: Option<Foo> } struct Foo { q: Option<Baz> } //~^ ERROR recursive type `Foo` has infinite size -//~| type `Foo` is embedded within `std::option::Option<Foo>`... -//~| ...which in turn is embedded within `std::option::Option<Foo>`... -//~| ...which in turn is embedded within `Baz`... -//~| ...which in turn is embedded within `std::option::Option<Baz>`... -//~| ...which in turn is embedded within `Foo`, completing the cycle. +//~| NOTE type `Foo` is embedded within `std::option::Option<Foo>`... +//~| NOTE ...which in turn is embedded within `std::option::Option<Foo>`... +//~| NOTE ...which in turn is embedded within `Baz`... +//~| NOTE ...which in turn is embedded within `std::option::Option<Baz>`... +//~| NOTE ...which in turn is embedded within `Foo`, completing the cycle. impl Foo { fn bar(&self) {} } |
