From b4e30bd2a3946c1f0a24ef52a130e0b8fddc00a8 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Wed, 14 Oct 2015 12:30:10 +0200 Subject: allow constant evaluation of function calls --- src/test/compile-fail/const-eval-span.rs | 2 +- src/test/compile-fail/const-fn-destructuring-arg.rs | 18 ++++++++++++++++++ src/test/compile-fail/const-fn-stability-calls-2.rs | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 src/test/compile-fail/const-fn-destructuring-arg.rs (limited to 'src/test/compile-fail') 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 or the MIT license +// , 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 } -- cgit 1.4.1-3-g733a5