diff options
| author | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2015-10-14 12:30:10 +0200 |
|---|---|---|
| committer | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2015-10-19 13:13:02 +0200 |
| commit | b4e30bd2a3946c1f0a24ef52a130e0b8fddc00a8 (patch) | |
| tree | 94912d182f780b4b76030f53ed5c9b7938f73853 /src/test/compile-fail | |
| parent | 9ed32bba778a38af942775b1a1013149e29dc822 (diff) | |
| download | rust-b4e30bd2a3946c1f0a24ef52a130e0b8fddc00a8.tar.gz rust-b4e30bd2a3946c1f0a24ef52a130e0b8fddc00a8.zip | |
allow constant evaluation of function calls
Diffstat (limited to 'src/test/compile-fail')
| -rw-r--r-- | src/test/compile-fail/const-eval-span.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/const-fn-destructuring-arg.rs | 18 | ||||
| -rw-r--r-- | src/test/compile-fail/const-fn-stability-calls-2.rs | 2 |
3 files changed, 20 insertions, 2 deletions
diff --git a/src/test/compile-fail/const-eval-span.rs b/src/test/compile-fail/const-eval-span.rs index 8e9209916f3..3e75afcda6d 100644 --- a/src/test/compile-fail/const-eval-span.rs +++ b/src/test/compile-fail/const-eval-span.rs @@ -14,7 +14,7 @@ struct S(i32); const CONSTANT: S = S(0); -//~^ ERROR: constant evaluation error: unsupported constant expr +//~^ ERROR: constant evaluation error: non-constant path in constant expression [E0080] enum E { V = CONSTANT, diff --git a/src/test/compile-fail/const-fn-destructuring-arg.rs b/src/test/compile-fail/const-fn-destructuring-arg.rs new file mode 100644 index 00000000000..1642c041067 --- /dev/null +++ b/src/test/compile-fail/const-fn-destructuring-arg.rs @@ -0,0 +1,18 @@ +// Copyright 2015 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. + +// test that certain things are disallowed in const fn signatures + +#![feature(const_fn)] + +// no destructuring +const fn i((a, b): (u32, u32)) -> u32 { a + b } //~ ERROR: E0022 + +fn main() {} diff --git a/src/test/compile-fail/const-fn-stability-calls-2.rs b/src/test/compile-fail/const-fn-stability-calls-2.rs index dd9a415311e..59e0db7b355 100644 --- a/src/test/compile-fail/const-fn-stability-calls-2.rs +++ b/src/test/compile-fail/const-fn-stability-calls-2.rs @@ -17,5 +17,5 @@ extern crate const_fn_lib; use const_fn_lib::foo; fn main() { - let x: [usize; foo()] = []; //~ ERROR unsupported constant expr + let x: [usize; foo()] = []; //~ ERROR non-constant path in constant expr } |
