about summary refs log tree commit diff
path: root/src/test/ui/consts/control-flow
diff options
context:
space:
mode:
authorDylan MacKenzie <ecstaticmorse@gmail.com>2020-06-25 17:43:48 -0700
committerDylan MacKenzie <ecstaticmorse@gmail.com>2020-06-28 10:08:12 -0700
commitd84f0c8d329017c95cbf73418be8e804b0a10472 (patch)
tree57302ae033385d1c7e0cc0b9a01d556b1970f84e /src/test/ui/consts/control-flow
parent7c46e4251219c25582f26b7838958a04b4b50bc6 (diff)
downloadrust-d84f0c8d329017c95cbf73418be8e804b0a10472.tar.gz
rust-d84f0c8d329017c95cbf73418be8e804b0a10472.zip
Update tests
Diffstat (limited to 'src/test/ui/consts/control-flow')
-rw-r--r--src/test/ui/consts/control-flow/basics.rs1
-rw-r--r--src/test/ui/consts/control-flow/drop-fail.precise.stderr4
-rw-r--r--src/test/ui/consts/control-flow/drop-fail.rs1
-rw-r--r--src/test/ui/consts/control-flow/drop-fail.stock.stderr8
-rw-r--r--src/test/ui/consts/control-flow/drop-pass.rs1
-rw-r--r--src/test/ui/consts/control-flow/drop-precise.rs1
-rw-r--r--src/test/ui/consts/control-flow/interior-mutability.rs2
-rw-r--r--src/test/ui/consts/control-flow/interior-mutability.stderr6
-rw-r--r--src/test/ui/consts/control-flow/loop.rs36
-rw-r--r--src/test/ui/consts/control-flow/loop.stderr (renamed from src/test/ui/consts/control-flow/loop.loop_.stderr)4
-rw-r--r--src/test/ui/consts/control-flow/loop.stock.stderr151
11 files changed, 25 insertions, 190 deletions
diff --git a/src/test/ui/consts/control-flow/basics.rs b/src/test/ui/consts/control-flow/basics.rs
index 3701f349d07..6dd6192941d 100644
--- a/src/test/ui/consts/control-flow/basics.rs
+++ b/src/test/ui/consts/control-flow/basics.rs
@@ -3,7 +3,6 @@
 // run-pass
 
 #![feature(const_panic)]
-#![feature(const_loop)]
 #![feature(const_fn)]
 
 const X: u32 = 4;
diff --git a/src/test/ui/consts/control-flow/drop-fail.precise.stderr b/src/test/ui/consts/control-flow/drop-fail.precise.stderr
index f4edfaf72be..0b0b2443a4a 100644
--- a/src/test/ui/consts/control-flow/drop-fail.precise.stderr
+++ b/src/test/ui/consts/control-flow/drop-fail.precise.stderr
@@ -1,11 +1,11 @@
 error[E0493]: destructors cannot be evaluated at compile-time
-  --> $DIR/drop-fail.rs:9:9
+  --> $DIR/drop-fail.rs:8:9
    |
 LL |     let x = Some(Vec::new());
    |         ^ constants cannot evaluate destructors
 
 error[E0493]: destructors cannot be evaluated at compile-time
-  --> $DIR/drop-fail.rs:40:9
+  --> $DIR/drop-fail.rs:39:9
    |
 LL |     let mut tmp = None;
    |         ^^^^^^^ constants cannot evaluate destructors
diff --git a/src/test/ui/consts/control-flow/drop-fail.rs b/src/test/ui/consts/control-flow/drop-fail.rs
index 94deeb8c54c..efa5a11c941 100644
--- a/src/test/ui/consts/control-flow/drop-fail.rs
+++ b/src/test/ui/consts/control-flow/drop-fail.rs
@@ -1,6 +1,5 @@
 // revisions: stock precise
 
-#![feature(const_loop)]
 #![cfg_attr(precise, feature(const_precise_live_drops))]
 
 // `x` is *not* always moved into the final value and may be dropped inside the initializer.
diff --git a/src/test/ui/consts/control-flow/drop-fail.stock.stderr b/src/test/ui/consts/control-flow/drop-fail.stock.stderr
index 94734222117..72ca4fa08bc 100644
--- a/src/test/ui/consts/control-flow/drop-fail.stock.stderr
+++ b/src/test/ui/consts/control-flow/drop-fail.stock.stderr
@@ -1,5 +1,5 @@
 error[E0493]: destructors cannot be evaluated at compile-time
-  --> $DIR/drop-fail.rs:9:9
+  --> $DIR/drop-fail.rs:8:9
    |
 LL |     let x = Some(Vec::new());
    |         ^ constants cannot evaluate destructors
@@ -8,7 +8,7 @@ LL | };
    | - value is dropped here
 
 error[E0493]: destructors cannot be evaluated at compile-time
-  --> $DIR/drop-fail.rs:22:9
+  --> $DIR/drop-fail.rs:21:9
    |
 LL |     let vec_tuple = (Vec::new(),);
    |         ^^^^^^^^^ constants cannot evaluate destructors
@@ -17,7 +17,7 @@ LL | };
    | - value is dropped here
 
 error[E0493]: destructors cannot be evaluated at compile-time
-  --> $DIR/drop-fail.rs:30:9
+  --> $DIR/drop-fail.rs:29:9
    |
 LL |     let x: Result<_, Vec<i32>> = Ok(Vec::new());
    |         ^ constants cannot evaluate destructors
@@ -26,7 +26,7 @@ LL | };
    | - value is dropped here
 
 error[E0493]: destructors cannot be evaluated at compile-time
-  --> $DIR/drop-fail.rs:40:9
+  --> $DIR/drop-fail.rs:39:9
    |
 LL |     let mut tmp = None;
    |         ^^^^^^^ constants cannot evaluate destructors
diff --git a/src/test/ui/consts/control-flow/drop-pass.rs b/src/test/ui/consts/control-flow/drop-pass.rs
index 2ef8e08d744..95f954a59a8 100644
--- a/src/test/ui/consts/control-flow/drop-pass.rs
+++ b/src/test/ui/consts/control-flow/drop-pass.rs
@@ -1,7 +1,6 @@
 // run-pass
 // revisions: stock precise
 
-#![feature(const_loop)]
 #![cfg_attr(precise, feature(const_precise_live_drops))]
 
 // `x` is always moved into the final value and is not dropped inside the initializer.
diff --git a/src/test/ui/consts/control-flow/drop-precise.rs b/src/test/ui/consts/control-flow/drop-precise.rs
index 058c5608ec1..4ecc5ef78dd 100644
--- a/src/test/ui/consts/control-flow/drop-precise.rs
+++ b/src/test/ui/consts/control-flow/drop-precise.rs
@@ -1,7 +1,6 @@
 // run-pass
 // gate-test-const_precise_live_drops
 
-#![feature(const_loop)]
 #![feature(const_precise_live_drops)]
 
 const _: Vec<i32> = {
diff --git a/src/test/ui/consts/control-flow/interior-mutability.rs b/src/test/ui/consts/control-flow/interior-mutability.rs
index cabdf4a929b..a6d44237b0d 100644
--- a/src/test/ui/consts/control-flow/interior-mutability.rs
+++ b/src/test/ui/consts/control-flow/interior-mutability.rs
@@ -1,8 +1,6 @@
 // Ensure that *any* assignment to the return place of a value with interior mutability
 // disqualifies it from promotion.
 
-#![feature(const_loop)]
-
 use std::cell::Cell;
 
 const X: Option<Cell<i32>> = {
diff --git a/src/test/ui/consts/control-flow/interior-mutability.stderr b/src/test/ui/consts/control-flow/interior-mutability.stderr
index 8f18ae1816a..4f9c7d34c35 100644
--- a/src/test/ui/consts/control-flow/interior-mutability.stderr
+++ b/src/test/ui/consts/control-flow/interior-mutability.stderr
@@ -1,5 +1,5 @@
 error[E0716]: temporary value dropped while borrowed
-  --> $DIR/interior-mutability.rs:42:26
+  --> $DIR/interior-mutability.rs:40:26
    |
 LL |     let x: &'static _ = &X;
    |            ----------    ^ creates a temporary which is freed while still in use
@@ -10,7 +10,7 @@ LL | }
    | - temporary value is freed at the end of this statement
 
 error[E0716]: temporary value dropped while borrowed
-  --> $DIR/interior-mutability.rs:43:26
+  --> $DIR/interior-mutability.rs:41:26
    |
 LL |     let y: &'static _ = &Y;
    |            ----------    ^ creates a temporary which is freed while still in use
@@ -21,7 +21,7 @@ LL | }
    | - temporary value is freed at the end of this statement
 
 error[E0716]: temporary value dropped while borrowed
-  --> $DIR/interior-mutability.rs:44:26
+  --> $DIR/interior-mutability.rs:42:26
    |
 LL |     let z: &'static _ = &Z;
    |            ----------    ^ creates a temporary which is freed while still in use
diff --git a/src/test/ui/consts/control-flow/loop.rs b/src/test/ui/consts/control-flow/loop.rs
index 30cc3d1b1af..2b8561a2644 100644
--- a/src/test/ui/consts/control-flow/loop.rs
+++ b/src/test/ui/consts/control-flow/loop.rs
@@ -1,29 +1,22 @@
-// Ensure that loops are forbidden in a const context unless `#![feature(const_loop)]` is enabled.
+const _: () = loop { break (); };
 
-// gate-test-const_loop
-// revisions: stock loop_
-
-#![cfg_attr(loop_, feature(const_loop))]
-
-const _: () = loop {}; //[stock]~ ERROR `loop` is not allowed in a `const`
-
-static FOO: i32 = loop { break 4; }; //[stock]~ ERROR `loop` is not allowed in a `static`
+static FOO: i32 = loop { break 4; };
 
 const fn foo() {
-    loop {} //[stock]~ ERROR `loop` is not allowed in a `const fn`
+    loop {}
 }
 
 pub trait Foo {
-    const BAR: i32 = loop { break 4; }; //[stock]~ ERROR `loop` is not allowed in a `const`
+    const BAR: i32 = loop { break 4; };
 }
 
 impl Foo for () {
-    const BAR: i32 = loop { break 4; }; //[stock]~ ERROR `loop` is not allowed in a `const`
+    const BAR: i32 = loop { break 4; };
 }
 
 fn non_const_outside() {
     const fn const_inside() {
-        loop {} //[stock]~ ERROR `loop` is not allowed in a `const fn`
+        loop {}
     }
 }
 
@@ -36,7 +29,6 @@ const fn const_outside() {
 fn main() {
     let x = [0; {
         while false {}
-        //[stock]~^ ERROR `while` is not allowed in a `const`
         4
     }];
 }
@@ -44,11 +36,11 @@ fn main() {
 const _: i32 = {
     let mut x = 0;
 
-    while x < 4 { //[stock]~ ERROR `while` is not allowed in a `const`
+    while x < 4 {
         x += 1;
     }
 
-    while x < 8 { //[stock]~ ERROR `while` is not allowed in a `const`
+    while x < 8 {
         x += 1;
     }
 
@@ -58,11 +50,11 @@ const _: i32 = {
 const _: i32 = {
     let mut x = 0;
 
-    for i in 0..4 { //[stock,loop_]~ ERROR `for` is not allowed in a `const`
+    for i in 0..4 { //~ ERROR `for` is not allowed in a `const`
         x += i;
     }
 
-    for i in 0..4 { //[stock,loop_]~ ERROR `for` is not allowed in a `const`
+    for i in 0..4 { //~ ERROR `for` is not allowed in a `const`
         x += i;
     }
 
@@ -72,14 +64,14 @@ const _: i32 = {
 const _: i32 = {
     let mut x = 0;
 
-    loop { //[stock]~ ERROR `loop` is not allowed in a `const`
+    loop {
         x += 1;
         if x == 4 {
             break;
         }
     }
 
-    loop { //[stock]~ ERROR `loop` is not allowed in a `const`
+    loop {
         x += 1;
         if x == 8 {
             break;
@@ -91,7 +83,7 @@ const _: i32 = {
 
 const _: i32 = {
     let mut x = 0;
-    while let None = Some(x) { } //[stock]~ ERROR `while` is not allowed in a `const`
-    while let None = Some(x) { } //[stock]~ ERROR `while` is not allowed in a `const`
+    while let None = Some(x) { }
+    while let None = Some(x) { }
     x
 };
diff --git a/src/test/ui/consts/control-flow/loop.loop_.stderr b/src/test/ui/consts/control-flow/loop.stderr
index c40cee6620e..7b99fa4fe46 100644
--- a/src/test/ui/consts/control-flow/loop.loop_.stderr
+++ b/src/test/ui/consts/control-flow/loop.stderr
@@ -1,5 +1,5 @@
 error[E0744]: `for` is not allowed in a `const`
-  --> $DIR/loop.rs:61:5
+  --> $DIR/loop.rs:53:5
    |
 LL | /     for i in 0..4 {
 LL | |         x += i;
@@ -7,7 +7,7 @@ LL | |     }
    | |_____^
 
 error[E0744]: `for` is not allowed in a `const`
-  --> $DIR/loop.rs:65:5
+  --> $DIR/loop.rs:57:5
    |
 LL | /     for i in 0..4 {
 LL | |         x += i;
diff --git a/src/test/ui/consts/control-flow/loop.stock.stderr b/src/test/ui/consts/control-flow/loop.stock.stderr
deleted file mode 100644
index a9ac3929bba..00000000000
--- a/src/test/ui/consts/control-flow/loop.stock.stderr
+++ /dev/null
@@ -1,151 +0,0 @@
-error[E0658]: `loop` is not allowed in a `const`
-  --> $DIR/loop.rs:8:15
-   |
-LL | const _: () = loop {};
-   |               ^^^^^^^
-   |
-   = note: see issue #52000 <https://github.com/rust-lang/rust/issues/52000> for more information
-   = help: add `#![feature(const_loop)]` to the crate attributes to enable
-
-error[E0658]: `loop` is not allowed in a `static`
-  --> $DIR/loop.rs:10:19
-   |
-LL | static FOO: i32 = loop { break 4; };
-   |                   ^^^^^^^^^^^^^^^^^
-   |
-   = note: see issue #52000 <https://github.com/rust-lang/rust/issues/52000> for more information
-   = help: add `#![feature(const_loop)]` to the crate attributes to enable
-
-error[E0658]: `loop` is not allowed in a `const fn`
-  --> $DIR/loop.rs:13:5
-   |
-LL |     loop {}
-   |     ^^^^^^^
-   |
-   = note: see issue #52000 <https://github.com/rust-lang/rust/issues/52000> for more information
-   = help: add `#![feature(const_loop)]` to the crate attributes to enable
-
-error[E0658]: `loop` is not allowed in a `const fn`
-  --> $DIR/loop.rs:26:9
-   |
-LL |         loop {}
-   |         ^^^^^^^
-   |
-   = note: see issue #52000 <https://github.com/rust-lang/rust/issues/52000> for more information
-   = help: add `#![feature(const_loop)]` to the crate attributes to enable
-
-error[E0658]: `while` is not allowed in a `const`
-  --> $DIR/loop.rs:38:9
-   |
-LL |         while false {}
-   |         ^^^^^^^^^^^^^^
-   |
-   = note: see issue #52000 <https://github.com/rust-lang/rust/issues/52000> for more information
-   = help: add `#![feature(const_loop)]` to the crate attributes to enable
-
-error[E0658]: `while` is not allowed in a `const`
-  --> $DIR/loop.rs:47:5
-   |
-LL | /     while x < 4 {
-LL | |         x += 1;
-LL | |     }
-   | |_____^
-   |
-   = note: see issue #52000 <https://github.com/rust-lang/rust/issues/52000> for more information
-   = help: add `#![feature(const_loop)]` to the crate attributes to enable
-
-error[E0658]: `while` is not allowed in a `const`
-  --> $DIR/loop.rs:51:5
-   |
-LL | /     while x < 8 {
-LL | |         x += 1;
-LL | |     }
-   | |_____^
-   |
-   = note: see issue #52000 <https://github.com/rust-lang/rust/issues/52000> for more information
-   = help: add `#![feature(const_loop)]` to the crate attributes to enable
-
-error[E0744]: `for` is not allowed in a `const`
-  --> $DIR/loop.rs:61:5
-   |
-LL | /     for i in 0..4 {
-LL | |         x += i;
-LL | |     }
-   | |_____^
-
-error[E0744]: `for` is not allowed in a `const`
-  --> $DIR/loop.rs:65:5
-   |
-LL | /     for i in 0..4 {
-LL | |         x += i;
-LL | |     }
-   | |_____^
-
-error[E0658]: `loop` is not allowed in a `const`
-  --> $DIR/loop.rs:75:5
-   |
-LL | /     loop {
-LL | |         x += 1;
-LL | |         if x == 4 {
-LL | |             break;
-LL | |         }
-LL | |     }
-   | |_____^
-   |
-   = note: see issue #52000 <https://github.com/rust-lang/rust/issues/52000> for more information
-   = help: add `#![feature(const_loop)]` to the crate attributes to enable
-
-error[E0658]: `loop` is not allowed in a `const`
-  --> $DIR/loop.rs:82:5
-   |
-LL | /     loop {
-LL | |         x += 1;
-LL | |         if x == 8 {
-LL | |             break;
-LL | |         }
-LL | |     }
-   | |_____^
-   |
-   = note: see issue #52000 <https://github.com/rust-lang/rust/issues/52000> for more information
-   = help: add `#![feature(const_loop)]` to the crate attributes to enable
-
-error[E0658]: `while` is not allowed in a `const`
-  --> $DIR/loop.rs:94:5
-   |
-LL |     while let None = Some(x) { }
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: see issue #52000 <https://github.com/rust-lang/rust/issues/52000> for more information
-   = help: add `#![feature(const_loop)]` to the crate attributes to enable
-
-error[E0658]: `while` is not allowed in a `const`
-  --> $DIR/loop.rs:95:5
-   |
-LL |     while let None = Some(x) { }
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: see issue #52000 <https://github.com/rust-lang/rust/issues/52000> for more information
-   = help: add `#![feature(const_loop)]` to the crate attributes to enable
-
-error[E0658]: `loop` is not allowed in a `const`
-  --> $DIR/loop.rs:17:22
-   |
-LL |     const BAR: i32 = loop { break 4; };
-   |                      ^^^^^^^^^^^^^^^^^
-   |
-   = note: see issue #52000 <https://github.com/rust-lang/rust/issues/52000> for more information
-   = help: add `#![feature(const_loop)]` to the crate attributes to enable
-
-error[E0658]: `loop` is not allowed in a `const`
-  --> $DIR/loop.rs:21:22
-   |
-LL |     const BAR: i32 = loop { break 4; };
-   |                      ^^^^^^^^^^^^^^^^^
-   |
-   = note: see issue #52000 <https://github.com/rust-lang/rust/issues/52000> for more information
-   = help: add `#![feature(const_loop)]` to the crate attributes to enable
-
-error: aborting due to 15 previous errors
-
-Some errors have detailed explanations: E0658, E0744.
-For more information about an error, try `rustc --explain E0658`.