Bless modified tests

This commit is contained in:
Dylan MacKenzie 2019-12-10 21:11:53 -08:00
parent caa7c99172
commit 3325671036
7 changed files with 298 additions and 80 deletions

View File

@ -1,21 +1,27 @@
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/drop-failure.rs:6:9
--> $DIR/drop-failure.rs:7:9
|
LL | let x = Some(Vec::new());
| ^ constants cannot evaluate destructors
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/drop-failure.rs:19:9
--> $DIR/drop-failure.rs:20:9
|
LL | let vec_tuple = (Vec::new(),);
| ^^^^^^^^^ constants cannot evaluate destructors
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/drop-failure.rs:27:9
--> $DIR/drop-failure.rs:28:9
|
LL | let x: Result<_, Vec<i32>> = Ok(Vec::new());
| ^ constants cannot evaluate destructors
error: aborting due to 3 previous errors
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/drop-failure.rs:38:9
|
LL | let mut tmp = None;
| ^^^^^^^ constants cannot evaluate destructors
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0493`.

View File

@ -1,24 +1,35 @@
error[E0716]: temporary value dropped while borrowed
--> $DIR/interior-mutability.rs:25:26
--> $DIR/interior-mutability.rs:40:26
|
LL | let x: &'static _ = &X;
| ---------- ^ creates a temporary which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL | let y: &'static _ = &Y;
...
LL | }
| - temporary value is freed at the end of this statement
error[E0716]: temporary value dropped while borrowed
--> $DIR/interior-mutability.rs:26:26
--> $DIR/interior-mutability.rs:41:26
|
LL | let y: &'static _ = &Y;
| ---------- ^ creates a temporary which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL | let z: &'static _ = &Z;
LL | }
| - temporary value is freed at the end of this statement
error[E0716]: temporary value dropped while borrowed
--> $DIR/interior-mutability.rs:42:26
|
LL | let z: &'static _ = &Z;
| ---------- ^ creates a temporary which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL | }
| - temporary value is freed at the end of this statement
error: aborting due to 2 previous errors
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0716`.

View File

@ -0,0 +1,19 @@
error[E0744]: `for` is not allowed in a `const`
--> $DIR/loop.rs:63:5
|
LL | / for i in 0..4 {
LL | | x += i;
LL | | }
| |_____^
error[E0744]: `for` is not allowed in a `const`
--> $DIR/loop.rs:67:5
|
LL | / for i in 0..4 {
LL | | x += i;
LL | | }
| |_____^
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0744`.

View File

@ -1,51 +1,72 @@
error[E0744]: `loop` is not allowed in a `const`
--> $DIR/loop.rs:8:15
error[E0658]: `loop` is not allowed in a `const`
--> $DIR/loop.rs:10:15
|
LL | const _: () = loop {};
| ^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= help: add `#![feature(const_loop)]` to the crate attributes to enable
error[E0744]: `loop` is not allowed in a `static`
--> $DIR/loop.rs:10:19
error[E0658]: `loop` is not allowed in a `static`
--> $DIR/loop.rs:12:19
|
LL | static FOO: i32 = loop { break 4; };
| ^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= help: add `#![feature(const_loop)]` to the crate attributes to enable
error[E0744]: `loop` is not allowed in a `const fn`
--> $DIR/loop.rs:13:5
error[E0658]: `loop` is not allowed in a `const fn`
--> $DIR/loop.rs:15:5
|
LL | loop {}
| ^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= help: add `#![feature(const_loop)]` to the crate attributes to enable
error[E0744]: `loop` is not allowed in a `const fn`
--> $DIR/loop.rs:26:9
error[E0658]: `loop` is not allowed in a `const fn`
--> $DIR/loop.rs:28:9
|
LL | loop {}
| ^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= help: add `#![feature(const_loop)]` to the crate attributes to enable
error[E0744]: `while` is not allowed in a `const`
--> $DIR/loop.rs:38:9
error[E0658]: `while` is not allowed in a `const`
--> $DIR/loop.rs:40:9
|
LL | while false {}
| ^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= help: add `#![feature(const_loop)]` to the crate attributes to enable
error[E0744]: `while` is not allowed in a `const`
--> $DIR/loop.rs:47:5
error[E0658]: `while` is not allowed in a `const`
--> $DIR/loop.rs:49:5
|
LL | / while x < 4 {
LL | | x += 1;
LL | | }
| |_____^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= help: add `#![feature(const_loop)]` to the crate attributes to enable
error[E0744]: `while` is not allowed in a `const`
--> $DIR/loop.rs:51:5
error[E0658]: `while` is not allowed in a `const`
--> $DIR/loop.rs:53:5
|
LL | / while x < 8 {
LL | | x += 1;
LL | | }
| |_____^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= 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
--> $DIR/loop.rs:63:5
|
LL | / for i in 0..4 {
LL | | x += i;
@ -53,15 +74,15 @@ LL | | }
| |_____^
error[E0744]: `for` is not allowed in a `const`
--> $DIR/loop.rs:65:5
--> $DIR/loop.rs:67:5
|
LL | / for i in 0..4 {
LL | | x += i;
LL | | }
| |_____^
error[E0744]: `loop` is not allowed in a `const`
--> $DIR/loop.rs:75:5
error[E0658]: `loop` is not allowed in a `const`
--> $DIR/loop.rs:77:5
|
LL | / loop {
LL | | x += 1;
@ -70,9 +91,12 @@ LL | | break;
LL | | }
LL | | }
| |_____^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= help: add `#![feature(const_loop)]` to the crate attributes to enable
error[E0744]: `loop` is not allowed in a `const`
--> $DIR/loop.rs:82:5
error[E0658]: `loop` is not allowed in a `const`
--> $DIR/loop.rs:84:5
|
LL | / loop {
LL | | x += 1;
@ -81,31 +105,47 @@ LL | | break;
LL | | }
LL | | }
| |_____^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= help: add `#![feature(const_loop)]` to the crate attributes to enable
error[E0744]: `while` is not allowed in a `const`
--> $DIR/loop.rs:94:5
error[E0658]: `while` is not allowed in a `const`
--> $DIR/loop.rs:96:5
|
LL | while let None = Some(x) { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= help: add `#![feature(const_loop)]` to the crate attributes to enable
error[E0744]: `while` is not allowed in a `const`
--> $DIR/loop.rs:95:5
error[E0658]: `while` is not allowed in a `const`
--> $DIR/loop.rs:97:5
|
LL | while let None = Some(x) { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= help: add `#![feature(const_loop)]` to the crate attributes to enable
error[E0744]: `loop` is not allowed in a `const`
--> $DIR/loop.rs:17:22
error[E0658]: `loop` is not allowed in a `const`
--> $DIR/loop.rs:19:22
|
LL | const BAR: i32 = loop { break 4; };
| ^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= help: add `#![feature(const_loop)]` to the crate attributes to enable
error[E0744]: `loop` is not allowed in a `const`
--> $DIR/loop.rs:21:22
error[E0658]: `loop` is not allowed in a `const`
--> $DIR/loop.rs:23:22
|
LL | const BAR: i32 = loop { break 4; };
| ^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= help: add `#![feature(const_loop)]` to the crate attributes to enable
error: aborting due to 15 previous errors
For more information about this error, try `rustc --explain E0744`.
Some errors have detailed explanations: E0658, E0744.
For more information about an error, try `rustc --explain E0658`.

View File

@ -0,0 +1,96 @@
error[E0658]: `while` is not allowed in a `const`
--> $DIR/loop.rs:40:9
|
LL | while false {}
| ^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/49146
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
= note: `#![feature(const_loop)]` alone is not sufficient, since this loop expression contains an implicit conditional
error[E0658]: `while` is not allowed in a `const`
--> $DIR/loop.rs:49:5
|
LL | / while x < 4 {
LL | | x += 1;
LL | | }
| |_____^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/49146
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
= note: `#![feature(const_loop)]` alone is not sufficient, since this loop expression contains an implicit conditional
error[E0658]: `while` is not allowed in a `const`
--> $DIR/loop.rs:53:5
|
LL | / while x < 8 {
LL | | x += 1;
LL | | }
| |_____^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/49146
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
= note: `#![feature(const_loop)]` alone is not sufficient, since this loop expression contains an implicit conditional
error[E0744]: `for` is not allowed in a `const`
--> $DIR/loop.rs:63:5
|
LL | / for i in 0..4 {
LL | | x += i;
LL | | }
| |_____^
error[E0744]: `for` is not allowed in a `const`
--> $DIR/loop.rs:67:5
|
LL | / for i in 0..4 {
LL | | x += i;
LL | | }
| |_____^
error[E0658]: `if` is not allowed in a `const`
--> $DIR/loop.rs:79:9
|
LL | / if x == 4 {
LL | | break;
LL | | }
| |_________^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/49146
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
error[E0658]: `if` is not allowed in a `const`
--> $DIR/loop.rs:86:9
|
LL | / if x == 8 {
LL | | break;
LL | | }
| |_________^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/49146
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
error[E0658]: `while` is not allowed in a `const`
--> $DIR/loop.rs:96:5
|
LL | while let None = Some(x) { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/49146
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
= note: `#![feature(const_loop)]` alone is not sufficient, since this loop expression contains an implicit conditional
error[E0658]: `while` is not allowed in a `const`
--> $DIR/loop.rs:97:5
|
LL | while let None = Some(x) { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/49146
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
= note: `#![feature(const_loop)]` alone is not sufficient, since this loop expression contains an implicit conditional
error: aborting due to 9 previous errors
Some errors have detailed explanations: E0658, E0744.
For more information about an error, try `rustc --explain E0658`.

View File

@ -1,9 +1,11 @@
// Ensure that all loops are forbidden in a const context, even if `#![feature(const_if_match)]` is
// enabled.
// Ensure that loops are forbidden in a const context unless `#![feature(const_loop)]` are enabled.
// `while` loops require `#![feature(const_if_match)]` to be enabled as well.
// revisions: stock if_match
// gate-test-const_loop
// revisions: stock if_match loop_ both
#![cfg_attr(if_match, feature(const_if_match))]
#![cfg_attr(any(both, if_match), feature(const_if_match))]
#![cfg_attr(any(both, loop_), feature(const_loop))]
const _: () = loop {}; //[stock,if_match]~ ERROR `loop` is not allowed in a `const`
@ -36,7 +38,7 @@ const fn const_outside() {
fn main() {
let x = [0; {
while false {}
//[stock,if_match]~^ ERROR `while` is not allowed in a `const`
//[stock,if_match,loop_]~^ ERROR `while` is not allowed in a `const`
4
}];
}
@ -44,11 +46,11 @@ fn main() {
const _: i32 = {
let mut x = 0;
while x < 4 { //[stock,if_match]~ ERROR `while` is not allowed in a `const`
while x < 4 { //[stock,if_match,loop_]~ ERROR `while` is not allowed in a `const`
x += 1;
}
while x < 8 { //[stock,if_match]~ ERROR `while` is not allowed in a `const`
while x < 8 { //[stock,if_match,loop_]~ ERROR `while` is not allowed in a `const`
x += 1;
}
@ -58,11 +60,11 @@ const _: i32 = {
const _: i32 = {
let mut x = 0;
for i in 0..4 { //[stock,if_match]~ ERROR `for` is not allowed in a `const`
for i in 0..4 { //[stock,if_match,loop_,both]~ ERROR `for` is not allowed in a `const`
x += i;
}
for i in 0..4 { //[stock,if_match]~ ERROR `for` is not allowed in a `const`
for i in 0..4 { //[stock,if_match,loop_,both]~ ERROR `for` is not allowed in a `const`
x += i;
}
@ -74,14 +76,14 @@ const _: i32 = {
loop { //[stock,if_match]~ ERROR `loop` is not allowed in a `const`
x += 1;
if x == 4 { //[stock]~ ERROR `if` is not allowed in a `const`
if x == 4 { //[stock,loop_]~ ERROR `if` is not allowed in a `const`
break;
}
}
loop { //[stock,if_match]~ ERROR `loop` is not allowed in a `const`
x += 1;
if x == 8 { //[stock]~ ERROR `if` is not allowed in a `const`
if x == 8 { //[stock,loop_]~ ERROR `if` is not allowed in a `const`
break;
}
}
@ -91,7 +93,7 @@ const _: i32 = {
const _: i32 = {
let mut x = 0;
while let None = Some(x) { } //[stock,if_match]~ ERROR `while` is not allowed in a `const`
while let None = Some(x) { } //[stock,if_match]~ ERROR `while` is not allowed in a `const`
while let None = Some(x) { } //[stock,if_match,loop_]~ ERROR `while` is not allowed in a `const`
while let None = Some(x) { } //[stock,if_match,loop_]~ ERROR `while` is not allowed in a `const`
x
};

View File

@ -1,51 +1,75 @@
error[E0744]: `loop` is not allowed in a `const`
--> $DIR/loop.rs:8:15
error[E0658]: `loop` is not allowed in a `const`
--> $DIR/loop.rs:10:15
|
LL | const _: () = loop {};
| ^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= help: add `#![feature(const_loop)]` to the crate attributes to enable
error[E0744]: `loop` is not allowed in a `static`
--> $DIR/loop.rs:10:19
error[E0658]: `loop` is not allowed in a `static`
--> $DIR/loop.rs:12:19
|
LL | static FOO: i32 = loop { break 4; };
| ^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= help: add `#![feature(const_loop)]` to the crate attributes to enable
error[E0744]: `loop` is not allowed in a `const fn`
--> $DIR/loop.rs:13:5
error[E0658]: `loop` is not allowed in a `const fn`
--> $DIR/loop.rs:15:5
|
LL | loop {}
| ^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= help: add `#![feature(const_loop)]` to the crate attributes to enable
error[E0744]: `loop` is not allowed in a `const fn`
--> $DIR/loop.rs:26:9
error[E0658]: `loop` is not allowed in a `const fn`
--> $DIR/loop.rs:28:9
|
LL | loop {}
| ^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= help: add `#![feature(const_loop)]` to the crate attributes to enable
error[E0744]: `while` is not allowed in a `const`
--> $DIR/loop.rs:38:9
error[E0658]: `while` is not allowed in a `const`
--> $DIR/loop.rs:40:9
|
LL | while false {}
| ^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= help: add `#![feature(const_loop)]` to the crate attributes to enable
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
error[E0744]: `while` is not allowed in a `const`
--> $DIR/loop.rs:47:5
error[E0658]: `while` is not allowed in a `const`
--> $DIR/loop.rs:49:5
|
LL | / while x < 4 {
LL | | x += 1;
LL | | }
| |_____^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= help: add `#![feature(const_loop)]` to the crate attributes to enable
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
error[E0744]: `while` is not allowed in a `const`
--> $DIR/loop.rs:51:5
error[E0658]: `while` is not allowed in a `const`
--> $DIR/loop.rs:53:5
|
LL | / while x < 8 {
LL | | x += 1;
LL | | }
| |_____^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= help: add `#![feature(const_loop)]` to the crate attributes to enable
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
error[E0744]: `for` is not allowed in a `const`
--> $DIR/loop.rs:61:5
--> $DIR/loop.rs:63:5
|
LL | / for i in 0..4 {
LL | | x += i;
@ -53,15 +77,15 @@ LL | | }
| |_____^
error[E0744]: `for` is not allowed in a `const`
--> $DIR/loop.rs:65:5
--> $DIR/loop.rs:67:5
|
LL | / for i in 0..4 {
LL | | x += i;
LL | | }
| |_____^
error[E0744]: `loop` is not allowed in a `const`
--> $DIR/loop.rs:75:5
error[E0658]: `loop` is not allowed in a `const`
--> $DIR/loop.rs:77:5
|
LL | / loop {
LL | | x += 1;
@ -70,9 +94,12 @@ LL | | break;
LL | | }
LL | | }
| |_____^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= help: add `#![feature(const_loop)]` to the crate attributes to enable
error[E0658]: `if` is not allowed in a `const`
--> $DIR/loop.rs:77:9
--> $DIR/loop.rs:79:9
|
LL | / if x == 4 {
LL | | break;
@ -82,8 +109,8 @@ LL | | }
= note: for more information, see https://github.com/rust-lang/rust/issues/49146
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
error[E0744]: `loop` is not allowed in a `const`
--> $DIR/loop.rs:82:5
error[E0658]: `loop` is not allowed in a `const`
--> $DIR/loop.rs:84:5
|
LL | / loop {
LL | | x += 1;
@ -92,9 +119,12 @@ LL | | break;
LL | | }
LL | | }
| |_____^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= help: add `#![feature(const_loop)]` to the crate attributes to enable
error[E0658]: `if` is not allowed in a `const`
--> $DIR/loop.rs:84:9
--> $DIR/loop.rs:86:9
|
LL | / if x == 8 {
LL | | break;
@ -104,29 +134,43 @@ LL | | }
= note: for more information, see https://github.com/rust-lang/rust/issues/49146
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
error[E0744]: `while` is not allowed in a `const`
--> $DIR/loop.rs:94:5
error[E0658]: `while` is not allowed in a `const`
--> $DIR/loop.rs:96:5
|
LL | while let None = Some(x) { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= help: add `#![feature(const_loop)]` to the crate attributes to enable
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
error[E0744]: `while` is not allowed in a `const`
--> $DIR/loop.rs:95:5
error[E0658]: `while` is not allowed in a `const`
--> $DIR/loop.rs:97:5
|
LL | while let None = Some(x) { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= help: add `#![feature(const_loop)]` to the crate attributes to enable
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
error[E0744]: `loop` is not allowed in a `const`
--> $DIR/loop.rs:17:22
error[E0658]: `loop` is not allowed in a `const`
--> $DIR/loop.rs:19:22
|
LL | const BAR: i32 = loop { break 4; };
| ^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= help: add `#![feature(const_loop)]` to the crate attributes to enable
error[E0744]: `loop` is not allowed in a `const`
--> $DIR/loop.rs:21:22
error[E0658]: `loop` is not allowed in a `const`
--> $DIR/loop.rs:23:22
|
LL | const BAR: i32 = loop { break 4; };
| ^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/52000
= help: add `#![feature(const_loop)]` to the crate attributes to enable
error: aborting due to 17 previous errors