Update tests

This commit is contained in:
Jonas Schievink 2021-07-29 23:15:53 +02:00
parent 4ee1840c0c
commit 550948c553
10 changed files with 42 additions and 16 deletions

View file

@ -7,7 +7,7 @@ const fn f(x: usize) -> usize {
//~| ERROR calls in constant functions
//~| ERROR calls in constant functions
//~| ERROR E0080
//~| ERROR E0744
//~| ERROR `for` is not allowed in a `const fn`
sum += i;
}
sum

View file

@ -1,4 +1,4 @@
error[E0744]: `for` is not allowed in a `const fn`
error[E0658]: `for` is not allowed in a `const fn`
--> $DIR/const-fn-error.rs:5:5
|
LL | / for i in 0..x {
@ -9,6 +9,9 @@ LL | |
LL | | sum += i;
LL | | }
| |_____^
|
= note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
= help: add `#![feature(const_for)]` 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:5:14
@ -45,5 +48,5 @@ LL | let a : [i32; f(X)];
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0015, E0080, E0658, E0744.
Some errors have detailed explanations: E0015, E0080, E0658.
For more information about an error, try `rustc --explain E0015`.

View file

@ -4,6 +4,7 @@ error[E0658]: `for` is not allowed in a `const`
LL | for _ in 0..5 {}
| ^^^^^^^^^^^^^^^^
|
= note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
= help: add `#![feature(const_for)]` to the crate attributes to enable
error: aborting due to previous error

View file

@ -4,6 +4,7 @@ error[E0658]: `?` is not allowed in a `const fn`
LL | Some(())?;
| ^^^^^^^^^
|
= note: see issue #74935 <https://github.com/rust-lang/rust/issues/74935> for more information
= help: add `#![feature(const_try)]` to the crate attributes to enable
error: aborting due to previous error

View file

@ -1,19 +1,25 @@
error[E0744]: `for` is not allowed in a `const`
error[E0658]: `for` is not allowed in a `const`
--> $DIR/loop.rs:53:5
|
LL | / for i in 0..4 {
LL | | x += i;
LL | | }
| |_____^
|
= note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
= help: add `#![feature(const_for)]` to the crate attributes to enable
error[E0744]: `for` is not allowed in a `const`
error[E0658]: `for` is not allowed in a `const`
--> $DIR/loop.rs:57:5
|
LL | / for i in 0..4 {
LL | | x += i;
LL | | }
| |_____^
|
= note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
= help: add `#![feature(const_for)]` to the crate attributes to enable
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0744`.
For more information about this error, try `rustc --explain E0658`.

View file

@ -1,9 +1,12 @@
error[E0744]: `?` is not allowed in a `const fn`
error[E0658]: `?` is not allowed in a `const fn`
--> $DIR/try.rs:6:5
|
LL | x?;
| ^^
|
= note: see issue #74935 <https://github.com/rust-lang/rust/issues/74935> for more information
= help: add `#![feature(const_try)]` to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0744`.
For more information about this error, try `rustc --explain E0658`.

View file

@ -1,8 +1,11 @@
error[E0744]: `for` is not allowed in a `const`
error[E0658]: `for` is not allowed in a `const`
--> $DIR/issue-50582.rs:2:20
|
LL | Vec::<[(); 1 + for x in 0..1 {}]>::new();
| ^^^^^^^^^^^^^^^^
|
= note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
= help: add `#![feature(const_for)]` to the crate attributes to enable
error[E0277]: cannot add `()` to `{integer}`
--> $DIR/issue-50582.rs:2:18
@ -14,5 +17,5 @@ LL | Vec::<[(); 1 + for x in 0..1 {}]>::new();
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0277, E0744.
Some errors have detailed explanations: E0277, E0658.
For more information about an error, try `rustc --explain E0277`.

View file

@ -1,8 +1,11 @@
error[E0744]: `for` is not allowed in a `const`
error[E0658]: `for` is not allowed in a `const`
--> $DIR/issue-50585.rs:2:18
|
LL | |y: Vec<[(); for x in 0..2 {}]>| {};
| ^^^^^^^^^^^^^^^^
|
= note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
= help: add `#![feature(const_for)]` to the crate attributes to enable
error[E0308]: mismatched types
--> $DIR/issue-50585.rs:2:18
@ -12,5 +15,5 @@ LL | |y: Vec<[(); for x in 0..2 {}]>| {};
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0308, E0744.
Some errors have detailed explanations: E0308, E0658.
For more information about an error, try `rustc --explain E0308`.

View file

@ -6,11 +6,14 @@ LL | [(); {while true {break}; 0}];
|
= note: `#[warn(while_true)]` on by default
error[E0744]: `for` is not allowed in a `const`
error[E0658]: `for` is not allowed in a `const`
--> $DIR/issue-52443.rs:9:12
|
LL | [(); { for _ in 0usize.. {}; 0}];
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
= help: add `#![feature(const_for)]` to the crate attributes to enable
error[E0308]: mismatched types
--> $DIR/issue-52443.rs:2:10
@ -56,5 +59,5 @@ LL | [(); { for _ in 0usize.. {}; 0}];
error: aborting due to 6 previous errors; 1 warning emitted
Some errors have detailed explanations: E0015, E0308, E0658, E0744.
Some errors have detailed explanations: E0015, E0308, E0658.
For more information about an error, try `rustc --explain E0015`.

View file

@ -1,9 +1,12 @@
error[E0744]: `?` is not allowed in a `const fn`
error[E0658]: `?` is not allowed in a `const fn`
--> $DIR/hir-const-check.rs:11:9
|
LL | Some(())?;
| ^^^^^^^^^
|
= note: see issue #74935 <https://github.com/rust-lang/rust/issues/74935> for more information
= help: add `#![feature(const_try)]` to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0744`.
For more information about this error, try `rustc --explain E0658`.