--- /dev/null
+// 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 X : usize = 2;
+
+const fn f(x: usize) -> usize {
+ let mut sum = 0;
+ //~^ let bindings in constant functions are unstable
+ //~| statements in constant functions are unstable
+ for i in 0..x {
+ //~^ ERROR E0015
+ //~| ERROR E0019
+ sum += i;
+ }
+ sum
+}
+
+#[allow(unused_variables)]
+fn main() {
+ let a : [i32; f(X)]; //~ ERROR E0080
+}
--- /dev/null
+// Copyright 2018 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.
+
+fn main() {
+ [(); & { loop { continue } } ]; //~ ERROR mismatched types
+ [(); loop { break }]; //~ ERROR mismatched types
+ [(); {while true {break}; 0}]; //~ ERROR constant contains unimplemented expression type
+ [(); { for _ in 0usize.. {}; 0}]; //~ ERROR calls in constants are limited to constant functions
+ //~^ ERROR constant contains unimplemented expression type
+ //~| ERROR could not evaluate repeat length
+}
+++ /dev/null
-// Copyright 2018 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.
-
-fn main() {
- [(); & { loop { continue } } ]; //~ ERROR mismatched types
- [(); loop { break }]; //~ ERROR mismatched types
- [(); {while true {break}; 0}]; //~ ERROR constant contains unimplemented expression type
- [(); { for _ in 0usize.. {}; 0}]; //~ ERROR calls in constants are limited to constant functions
- //~^ ERROR constant contains unimplemented expression type
- //~| ERROR could not evaluate repeat length
-}
+++ /dev/null
-error[E0308]: mismatched types
- --> $DIR/issue-52443.rs:12:10
- |
-LL | [(); & { loop { continue } } ]; //~ ERROR mismatched types
- | ^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | expected usize, found reference
- | help: consider removing the borrow: `{ loop { continue } }`
- |
- = note: expected type `usize`
- found type `&_`
-
-error[E0308]: mismatched types
- --> $DIR/issue-52443.rs:13:17
- |
-LL | [(); loop { break }]; //~ ERROR mismatched types
- | ^^^^^ expected (), found usize
- |
- = note: expected type `()`
- found type `usize`
-
-error[E0019]: constant contains unimplemented expression type
- --> $DIR/issue-52443.rs:14:11
- |
-LL | [(); {while true {break}; 0}]; //~ ERROR constant contains unimplemented expression type
- | ^^^^^^^^^^^^^^^^^^
-
-error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
- --> $DIR/issue-52443.rs:15:21
- |
-LL | [(); { for _ in 0usize.. {}; 0}]; //~ ERROR calls in constants are limited to constant functions
- | ^^^^^^^^
-
-error[E0019]: constant contains unimplemented expression type
- --> $DIR/issue-52443.rs:15:21
- |
-LL | [(); { for _ in 0usize.. {}; 0}]; //~ ERROR calls in constants are limited to constant functions
- | ^^^^^^^^
-
-error[E0080]: could not evaluate repeat length
- --> $DIR/issue-52443.rs:15:10
- |
-LL | [(); { for _ in 0usize.. {}; 0}]; //~ ERROR calls in constants are limited to constant functions
- | ^^^^^^^^^^^--------^^^^^^^
- | |
- | inside call to `std::iter::range::<impl std::iter::Iterator for std::ops::RangeFrom<A>><usize>::next`
- |
- ::: $SRC_DIR/libcore/ptr.rs:LL:COL
- |
-LL | let z = read(x);
- | ------- inside call to `std::ptr::read::<usize>`
-...
-LL | let mut tmp: T = mem::uninitialized();
- | -------------------- inside call to `std::mem::uninitialized::<usize>`
- |
- ::: $SRC_DIR/libcore/iter/range.rs:LL:COL
- |
-LL | mem::swap(&mut n, &mut self.start);
- | ---------------------------------- inside call to `std::mem::swap::<usize>`
- |
- ::: $SRC_DIR/libcore/mem.rs:LL:COL
- |
-LL | intrinsics::uninit()
- | -------------------- "calling intrinsic `uninit`" needs an rfc before being allowed inside constants
-...
-LL | ptr::swap_nonoverlapping_one(x, y);
- | ---------------------------------- inside call to `std::ptr::swap_nonoverlapping_one::<usize>`
-
-error: aborting due to 6 previous errors
-
-Some errors occurred: E0015, E0019, E0080, E0308.
-For more information about an error, try `rustc --explain E0015`.
+++ /dev/null
-// 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 X : usize = 2;
-
-const fn f(x: usize) -> usize {
- let mut sum = 0;
- //~^ let bindings in constant functions are unstable
- //~| statements in constant functions are unstable
- for i in 0..x {
- //~^ ERROR E0015
- //~| ERROR E0019
- sum += i;
- }
- sum
-}
-
-#[allow(unused_variables)]
-fn main() {
- let a : [i32; f(X)]; //~ ERROR E0080
-}
+++ /dev/null
-error[E0658]: let bindings in constant functions are unstable (see issue #48821)
- --> $DIR/const-fn-error.rs:16:19
- |
-LL | let mut sum = 0;
- | ^
- |
- = help: add #![feature(const_let)] to the crate attributes to enable
-
-error[E0658]: statements in constant functions are unstable (see issue #48821)
- --> $DIR/const-fn-error.rs:16:19
- |
-LL | let mut sum = 0;
- | ^
- |
- = help: add #![feature(const_let)] to the crate attributes to enable
-
-error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants
- --> $DIR/const-fn-error.rs:19:14
- |
-LL | for i in 0..x {
- | ^^^^
-
-error[E0019]: constant function contains unimplemented expression type
- --> $DIR/const-fn-error.rs:19:14
- |
-LL | for i in 0..x {
- | ^^^^
-
-error[E0080]: could not evaluate constant expression
- --> $DIR/const-fn-error.rs:29:13
- |
-LL | for i in 0..x {
- | ---- inside call to `std::iter::range::<impl std::iter::Iterator for std::ops::Range<A>><usize>::next`
-...
-LL | let a : [i32; f(X)]; //~ ERROR E0080
- | ^^^^^^----^
- | |
- | inside call to `f`
- |
- ::: $SRC_DIR/libcore/ptr.rs:LL:COL
- |
-LL | let z = read(x);
- | ------- inside call to `std::ptr::read::<usize>`
-...
-LL | let mut tmp: T = mem::uninitialized();
- | -------------------- inside call to `std::mem::uninitialized::<usize>`
- |
- ::: $SRC_DIR/libcore/iter/range.rs:LL:COL
- |
-LL | mem::swap(&mut n, &mut self.start);
- | ---------------------------------- inside call to `std::mem::swap::<usize>`
- |
- ::: $SRC_DIR/libcore/mem.rs:LL:COL
- |
-LL | intrinsics::uninit()
- | -------------------- "calling intrinsic `uninit`" needs an rfc before being allowed inside constants
-...
-LL | ptr::swap_nonoverlapping_one(x, y);
- | ---------------------------------- inside call to `std::ptr::swap_nonoverlapping_one::<usize>`
-
-error: aborting due to 5 previous errors
-
-Some errors occurred: E0015, E0019, E0080, E0658.
-For more information about an error, try `rustc --explain E0015`.