]> git.lizzy.rs Git - rust.git/commitdiff
add unit tests for #29927
authorOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>
Tue, 1 Dec 2015 16:37:32 +0000 (17:37 +0100)
committerOliver 'ker' Schneider <rust19446194516@oli-obk.de>
Sun, 6 Dec 2015 11:59:53 +0000 (12:59 +0100)
src/test/run-pass/issue29927-1.rs [new file with mode: 0644]
src/test/run-pass/issue29927.rs [new file with mode: 0644]

diff --git a/src/test/run-pass/issue29927-1.rs b/src/test/run-pass/issue29927-1.rs
new file mode 100644 (file)
index 0000000..68271ac
--- /dev/null
@@ -0,0 +1,20 @@
+// 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.
+
+#![feature(const_fn)]
+const fn f() -> usize {
+    5
+}
+struct A {
+    field: usize,
+}
+fn main() {
+    let _ = [0; f()];
+}
diff --git a/src/test/run-pass/issue29927.rs b/src/test/run-pass/issue29927.rs
new file mode 100644 (file)
index 0000000..6d9adbc
--- /dev/null
@@ -0,0 +1,20 @@
+// 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.
+
+#![feature(const_fn)]
+struct A {
+    field: usize,
+}
+const fn f() -> usize {
+    5
+}
+fn main() {
+    let _ = [0; f()];
+}