+++ /dev/null
-// check-fail
-// compile-flags: -Z tiny-const-eval-limit
-
-const fn foo() {}
-
-const fn call_foo() -> u32 {
- foo();
- foo();
- foo();
- foo();
- foo();
-
- foo();
- foo();
- foo();
- foo();
- foo();
-
- foo();
- foo();
- foo();
- foo();
- foo();
-
- foo();
- foo();
- foo();
- foo(); //~ ERROR evaluation of constant value failed [E0080]
- 0
-}
-
-const X: u32 = call_foo();
-
-fn main() {
- println!("{X}");
-}
+++ /dev/null
-error[E0080]: evaluation of constant value failed
- --> $DIR/ctfe-fn-call.rs:28:5
- |
-LL | foo();
- | ^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`)
- |
-note: inside `call_foo`
- --> $DIR/ctfe-fn-call.rs:28:5
- |
-LL | foo();
- | ^^^^^
-note: inside `X`
- --> $DIR/ctfe-fn-call.rs:32:16
- |
-LL | const X: u32 = call_foo();
- | ^^^^^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0080`.
+++ /dev/null
-// check-fail
-// compile-flags: -Z tiny-const-eval-limit
-
-const fn labelled_loop(n: u32) -> u32 {
- let mut i = 0;
- 'mylabel: loop { //~ ERROR evaluation of constant value failed [E0080]
- if i > n {
- break 'mylabel
- }
- i += 1;
- }
- 0
-}
-
-const X: u32 = labelled_loop(19);
-
-fn main() {
- println!("{X}");
-}
+++ /dev/null
-error[E0080]: evaluation of constant value failed
- --> $DIR/ctfe-labelled-loop.rs:6:5
- |
-LL | / 'mylabel: loop {
-LL | | if i > n {
-LL | | break 'mylabel
-LL | | }
-LL | | i += 1;
-LL | | }
- | |_____^ exceeded interpreter step limit (see `#[const_eval_limit]`)
- |
-note: inside `labelled_loop`
- --> $DIR/ctfe-labelled-loop.rs:6:5
- |
-LL | / 'mylabel: loop {
-LL | | if i > n {
-LL | | break 'mylabel
-LL | | }
-LL | | i += 1;
-LL | | }
- | |_____^
-note: inside `X`
- --> $DIR/ctfe-labelled-loop.rs:15:16
- |
-LL | const X: u32 = labelled_loop(19);
- | ^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0080`.
+++ /dev/null
-// check-fail
-// compile-flags: -Z tiny-const-eval-limit
-
-const fn recurse(n: u32) -> u32 {
- if n == 0 {
- n
- } else {
- recurse(n - 1) //~ ERROR evaluation of constant value failed [E0080]
- }
-}
-
-const X: u32 = recurse(19);
-
-fn main() {
- println!("{X}");
-}
+++ /dev/null
-error[E0080]: evaluation of constant value failed
- --> $DIR/ctfe-recursion.rs:8:9
- |
-LL | recurse(n - 1)
- | ^^^^^^^^^^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`)
- |
-note: inside `recurse`
- --> $DIR/ctfe-recursion.rs:8:9
- |
-LL | recurse(n - 1)
- | ^^^^^^^^^^^^^^
-note: [... 18 additional calls inside `recurse` ...]
- --> $DIR/ctfe-recursion.rs:8:9
- |
-LL | recurse(n - 1)
- | ^^^^^^^^^^^^^^
-note: inside `X`
- --> $DIR/ctfe-recursion.rs:12:16
- |
-LL | const X: u32 = recurse(19);
- | ^^^^^^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0080`.
+++ /dev/null
-// check-fail
-// compile-flags: -Z tiny-const-eval-limit
-const fn simple_loop(n: u32) -> u32 {
- let mut index = 0;
- while index < n { //~ ERROR evaluation of constant value failed [E0080]
- index = index + 1;
- }
- 0
-}
-
-const X: u32 = simple_loop(19);
-
-fn main() {
- println!("{X}");
-}
+++ /dev/null
-error[E0080]: evaluation of constant value failed
- --> $DIR/ctfe-simple-loop.rs:5:5
- |
-LL | / while index < n {
-LL | | index = index + 1;
-LL | | }
- | |_____^ exceeded interpreter step limit (see `#[const_eval_limit]`)
- |
-note: inside `simple_loop`
- --> $DIR/ctfe-simple-loop.rs:5:5
- |
-LL | / while index < n {
-LL | | index = index + 1;
-LL | | }
- | |_____^
-note: inside `X`
- --> $DIR/ctfe-simple-loop.rs:11:16
- |
-LL | const X: u32 = simple_loop(19);
- | ^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0080`.
--- /dev/null
+// check-fail
+// compile-flags: -Z tiny-const-eval-limit
+
+const fn foo() {}
+
+const fn call_foo() -> u32 {
+ foo();
+ foo();
+ foo();
+ foo();
+ foo();
+
+ foo();
+ foo();
+ foo();
+ foo();
+ foo();
+
+ foo();
+ foo();
+ foo();
+ foo();
+ foo();
+
+ foo();
+ foo();
+ foo();
+ foo(); //~ ERROR evaluation of constant value failed [E0080]
+ 0
+}
+
+const X: u32 = call_foo();
+
+fn main() {
+ println!("{X}");
+}
--- /dev/null
+error[E0080]: evaluation of constant value failed
+ --> $DIR/ctfe-fn-call.rs:28:5
+ |
+LL | foo();
+ | ^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`)
+ |
+note: inside `call_foo`
+ --> $DIR/ctfe-fn-call.rs:28:5
+ |
+LL | foo();
+ | ^^^^^
+note: inside `X`
+ --> $DIR/ctfe-fn-call.rs:32:16
+ |
+LL | const X: u32 = call_foo();
+ | ^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0080`.
--- /dev/null
+// check-fail
+// compile-flags: -Z tiny-const-eval-limit
+
+const fn labelled_loop(n: u32) -> u32 {
+ let mut i = 0;
+ 'mylabel: loop { //~ ERROR evaluation of constant value failed [E0080]
+ if i > n {
+ break 'mylabel
+ }
+ i += 1;
+ }
+ 0
+}
+
+const X: u32 = labelled_loop(19);
+
+fn main() {
+ println!("{X}");
+}
--- /dev/null
+error[E0080]: evaluation of constant value failed
+ --> $DIR/ctfe-labelled-loop.rs:6:5
+ |
+LL | / 'mylabel: loop {
+LL | | if i > n {
+LL | | break 'mylabel
+LL | | }
+LL | | i += 1;
+LL | | }
+ | |_____^ exceeded interpreter step limit (see `#[const_eval_limit]`)
+ |
+note: inside `labelled_loop`
+ --> $DIR/ctfe-labelled-loop.rs:6:5
+ |
+LL | / 'mylabel: loop {
+LL | | if i > n {
+LL | | break 'mylabel
+LL | | }
+LL | | i += 1;
+LL | | }
+ | |_____^
+note: inside `X`
+ --> $DIR/ctfe-labelled-loop.rs:15:16
+ |
+LL | const X: u32 = labelled_loop(19);
+ | ^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0080`.
--- /dev/null
+// check-fail
+// compile-flags: -Z tiny-const-eval-limit
+
+const fn recurse(n: u32) -> u32 {
+ if n == 0 {
+ n
+ } else {
+ recurse(n - 1) //~ ERROR evaluation of constant value failed [E0080]
+ }
+}
+
+const X: u32 = recurse(19);
+
+fn main() {
+ println!("{X}");
+}
--- /dev/null
+error[E0080]: evaluation of constant value failed
+ --> $DIR/ctfe-recursion.rs:8:9
+ |
+LL | recurse(n - 1)
+ | ^^^^^^^^^^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`)
+ |
+note: inside `recurse`
+ --> $DIR/ctfe-recursion.rs:8:9
+ |
+LL | recurse(n - 1)
+ | ^^^^^^^^^^^^^^
+note: [... 18 additional calls inside `recurse` ...]
+ --> $DIR/ctfe-recursion.rs:8:9
+ |
+LL | recurse(n - 1)
+ | ^^^^^^^^^^^^^^
+note: inside `X`
+ --> $DIR/ctfe-recursion.rs:12:16
+ |
+LL | const X: u32 = recurse(19);
+ | ^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0080`.
--- /dev/null
+// check-fail
+// compile-flags: -Z tiny-const-eval-limit
+const fn simple_loop(n: u32) -> u32 {
+ let mut index = 0;
+ while index < n { //~ ERROR evaluation of constant value failed [E0080]
+ index = index + 1;
+ }
+ 0
+}
+
+const X: u32 = simple_loop(19);
+
+fn main() {
+ println!("{X}");
+}
--- /dev/null
+error[E0080]: evaluation of constant value failed
+ --> $DIR/ctfe-simple-loop.rs:5:5
+ |
+LL | / while index < n {
+LL | | index = index + 1;
+LL | | }
+ | |_____^ exceeded interpreter step limit (see `#[const_eval_limit]`)
+ |
+note: inside `simple_loop`
+ --> $DIR/ctfe-simple-loop.rs:5:5
+ |
+LL | / while index < n {
+LL | | index = index + 1;
+LL | | }
+ | |_____^
+note: inside `X`
+ --> $DIR/ctfe-simple-loop.rs:11:16
+ |
+LL | const X: u32 = simple_loop(19);
+ | ^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0080`.
--- /dev/null
+// check-pass
+//
+// Exercising an edge case which was found during Stage 2 compilation.
+// Compilation would fail for this code when running the `CtfeLimit`
+// MirPass (specifically when looking up the dominators).
+#![crate_type="lib"]
+
+const DUMMY: Expr = Expr::Path(ExprPath {
+ attrs: Vec::new(),
+ path: Vec::new(),
+});
+
+pub enum Expr {
+ Path(ExprPath),
+}
+pub struct ExprPath {
+ pub attrs: Vec<()>,
+ pub path: Vec<()>,
+}