about summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-12-05 02:48:03 +0000
committerbors <bors@rust-lang.org>2016-12-05 02:48:03 +0000
commit6bc551a261de4b62a50761e624dc8fd27c85c4ce (patch)
treef9df07a0b7567120de9f008739597643c39912fc /src/test/compile-fail
parentebeee0e27e32e212979d9f38d285b1dc2816cd0a (diff)
parentb8d8ab87c08f1a662db82198ab598f549df9cc22 (diff)
downloadrust-6bc551a261de4b62a50761e624dc8fd27c85c4ce.tar.gz
rust-6bc551a261de4b62a50761e624dc8fd27c85c4ce.zip
Auto merge of #38093 - mikhail-m1:stack-overflow, r=arielb1
fix stack overflow by enum and cont issue #36163

some paths were skipped while checking for recursion.

I fixed bug reproduces on win64 cargo test. In previous PR #36458 time complexity was exponential in case of linked const values. Now it's linear.

r? @alexcrichton
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/issue-36163.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/compile-fail/issue-36163.rs b/src/test/compile-fail/issue-36163.rs
new file mode 100644
index 00000000000..9dad6ede776
--- /dev/null
+++ b/src/test/compile-fail/issue-36163.rs
@@ -0,0 +1,26 @@
+// 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.
+
+const A: i32 = Foo::B; //~ ERROR E0265
+                       //~^ NOTE recursion not allowed in constant
+
+enum Foo {
+    B = A, //~ ERROR E0265
+           //~^ NOTE recursion not allowed in constant
+}
+
+enum Bar {
+    C = Bar::C, //~ ERROR E0265
+                //~^ NOTE recursion not allowed in constant
+}
+
+const D: i32 = A;
+
+fn main() {}