diff options
| author | Ralf Jung <post@ralfj.de> | 2018-11-16 18:05:08 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2018-11-16 18:05:08 +0100 |
| commit | 303dbccf040de2f61434dc7d716c5feed817fbdc (patch) | |
| tree | f21c762ea1d8d5dec0ed09b098ca5b7f647110d4 /src/test | |
| parent | 6b9b97bd9b704f85f0184f7a213cc4d62bd9654c (diff) | |
| download | rust-303dbccf040de2f61434dc7d716c5feed817fbdc.tar.gz rust-303dbccf040de2f61434dc7d716c5feed817fbdc.zip | |
CTFE: dynamically make sure we do not call non-const-fn
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/consts/const-call.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/consts/const-call.stderr | 11 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/test/ui/consts/const-call.rs b/src/test/ui/consts/const-call.rs index 18476494300..bd407192cd7 100644 --- a/src/test/ui/consts/const-call.rs +++ b/src/test/ui/consts/const-call.rs @@ -15,4 +15,5 @@ fn f(x: usize) -> usize { fn main() { let _ = [0; f(2)]; //~^ ERROR calls in constants are limited to constant functions + //~| ERROR evaluation of constant value failed } diff --git a/src/test/ui/consts/const-call.stderr b/src/test/ui/consts/const-call.stderr index 81be93e916e..219fcec51b3 100644 --- a/src/test/ui/consts/const-call.stderr +++ b/src/test/ui/consts/const-call.stderr @@ -4,6 +4,13 @@ error[E0015]: calls in constants are limited to constant functions, tuple struct LL | let _ = [0; f(2)]; | ^^^^ -error: aborting due to previous error +error[E0080]: evaluation of constant value failed + --> $DIR/const-call.rs:16:17 + | +LL | let _ = [0; f(2)]; + | ^^^^ calling non-const function `f` + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0015`. +Some errors occurred: E0015, E0080. +For more information about an error, try `rustc --explain E0015`. |
