summary refs log tree commit diff
path: root/src/test/run-pass/const-fn-const-eval.rs
diff options
context:
space:
mode:
authorOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>2015-10-14 12:30:10 +0200
committerOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>2015-10-19 13:13:02 +0200
commitb4e30bd2a3946c1f0a24ef52a130e0b8fddc00a8 (patch)
tree94912d182f780b4b76030f53ed5c9b7938f73853 /src/test/run-pass/const-fn-const-eval.rs
parent9ed32bba778a38af942775b1a1013149e29dc822 (diff)
downloadrust-b4e30bd2a3946c1f0a24ef52a130e0b8fddc00a8.tar.gz
rust-b4e30bd2a3946c1f0a24ef52a130e0b8fddc00a8.zip
allow constant evaluation of function calls
Diffstat (limited to 'src/test/run-pass/const-fn-const-eval.rs')
-rw-r--r--src/test/run-pass/const-fn-const-eval.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/run-pass/const-fn-const-eval.rs b/src/test/run-pass/const-fn-const-eval.rs
new file mode 100644
index 00000000000..77c70fe7f63
--- /dev/null
+++ b/src/test/run-pass/const-fn-const-eval.rs
@@ -0,0 +1,19 @@
+// Copyright 2012-2014 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.
+
+#![feature(const_fn)]
+
+const fn add(x: usize, y: usize) -> usize {
+    x + y
+}
+
+const ARR: [i32; add(1, 2)] = [5, 6, 7];
+
+pub fn main() {}