Skip to content

Commit 8fe1b1d

Browse files
Update tests
1 parent 984e536 commit 8fe1b1d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+105
-415
lines changed

src/test/compile-fail/issue-52443.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
fn main() {
22
[(); & { loop { continue } } ]; //~ ERROR mismatched types
3-
//~^ ERROR `loop` is not allowed in a `const`
3+
44
[(); loop { break }]; //~ ERROR mismatched types
5-
//~^ ERROR `loop` is not allowed in a `const`
5+
66
[(); {while true {break}; 0}];
7-
//~^ ERROR `while` is not allowed in a `const`
8-
//~| WARN denote infinite loops with
7+
//~^ WARN denote infinite loops with
8+
99
[(); { for _ in 0usize.. {}; 0}];
1010
//~^ ERROR `for` is not allowed in a `const`
1111
//~| ERROR calls in constants are limited to constant functions

src/test/ui/async-await/issue-70594.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ async fn fun() {
44
[1; ().await];
55
//~^ error: `await` is only allowed inside `async` functions and blocks
66
//~| error: `.await` is not allowed in a `const`
7-
//~| error: `loop` is not allowed in a `const`
87
//~| error: `.await` is not allowed in a `const`
98
//~| error: the trait bound `(): std::future::Future` is not satisfied
109
}

src/test/ui/async-await/issue-70594.stderr

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@ error[E0744]: `.await` is not allowed in a `const`
1212
LL | [1; ().await];
1313
| ^^^^^^^^
1414

15-
error[E0658]: `loop` is not allowed in a `const`
16-
--> $DIR/issue-70594.rs:4:9
17-
|
18-
LL | [1; ().await];
19-
| ^^^^^^^^
20-
|
21-
= note: see issue #52000 <https://github.com/rust-lang/rust/issues/52000> for more information
22-
= help: add `#![feature(const_loop)]` to the crate attributes to enable
23-
2415
error[E0744]: `.await` is not allowed in a `const`
2516
--> $DIR/issue-70594.rs:4:9
2617
|
@@ -35,7 +26,7 @@ LL | [1; ().await];
3526
|
3627
= note: required by `std::future::Future::poll`
3728

38-
error: aborting due to 5 previous errors
29+
error: aborting due to 4 previous errors
3930

40-
Some errors have detailed explanations: E0277, E0658, E0728, E0744.
31+
Some errors have detailed explanations: E0277, E0728, E0744.
4132
For more information about an error, try `rustc --explain E0277`.

src/test/ui/closures/issue-52437.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
fn main() {
22
[(); &(&'static: loop { |x| {}; }) as *const _ as usize]
33
//~^ ERROR: invalid label name `'static`
4-
//~| ERROR: `loop` is not allowed in a `const`
54
//~| ERROR: type annotations needed
65
//~| ERROR mismatched types
76
}

src/test/ui/closures/issue-52437.stderr

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,6 @@ error: invalid label name `'static`
44
LL | [(); &(&'static: loop { |x| {}; }) as *const _ as usize]
55
| ^^^^^^^
66

7-
error[E0658]: `loop` is not allowed in a `const`
8-
--> $DIR/issue-52437.rs:2:13
9-
|
10-
LL | [(); &(&'static: loop { |x| {}; }) as *const _ as usize]
11-
| ^^^^^^^^^^^^^^^^^^^^^^^^^
12-
|
13-
= note: see issue #52000 <https://github.com/rust-lang/rust/issues/52000> for more information
14-
= help: add `#![feature(const_loop)]` to the crate attributes to enable
15-
167
error[E0282]: type annotations needed
178
--> $DIR/issue-52437.rs:2:30
189
|
@@ -27,7 +18,7 @@ LL | fn main() {
2718
LL | [(); &(&'static: loop { |x| {}; }) as *const _ as usize]
2819
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found array `[(); _]`
2920

30-
error: aborting due to 4 previous errors
21+
error: aborting due to 3 previous errors
3122

32-
Some errors have detailed explanations: E0282, E0308, E0658.
23+
Some errors have detailed explanations: E0282, E0308.
3324
For more information about an error, try `rustc --explain E0282`.

src/test/ui/consts/const-eval/infinite_loop.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ fn main() {
44
let _ = [(); {
55
let mut n = 113383; // #20 in https://oeis.org/A006884
66
while n != 0 {
7-
//~^ ERROR `while` is not allowed in a `const`
87
n = if n % 2 == 0 { n/2 } else { 3*n + 1 };
98
//~^ ERROR evaluation of constant value failed
109
}
Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,9 @@
1-
error[E0658]: `while` is not allowed in a `const`
2-
--> $DIR/infinite_loop.rs:6:9
3-
|
4-
LL | / while n != 0 {
5-
LL | |
6-
LL | | n = if n % 2 == 0 { n/2 } else { 3*n + 1 };
7-
LL | |
8-
LL | | }
9-
| |_________^
10-
|
11-
= note: see issue #52000 <https://github.com/rust-lang/rust/issues/52000> for more information
12-
= help: add `#![feature(const_loop)]` to the crate attributes to enable
13-
141
error[E0080]: evaluation of constant value failed
15-
--> $DIR/infinite_loop.rs:8:17
2+
--> $DIR/infinite_loop.rs:7:17
163
|
174
LL | n = if n % 2 == 0 { n/2 } else { 3*n + 1 };
185
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`)
196

20-
error: aborting due to 2 previous errors
7+
error: aborting due to previous error
218

22-
Some errors have detailed explanations: E0080, E0658.
23-
For more information about an error, try `rustc --explain E0080`.
9+
For more information about this error, try `rustc --explain E0080`.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
fn main() {
22
[(); { &loop { break } as *const _ as usize } ];
3-
//~^ ERROR `loop` is not allowed in a `const`
4-
//~| ERROR casting pointers to integers in constants is unstable
3+
//~^ ERROR casting pointers to integers in constants is unstable
54
//~| ERROR evaluation of constant value failed
65
}
Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
error[E0658]: `loop` is not allowed in a `const`
2-
--> $DIR/issue-52442.rs:2:14
3-
|
4-
LL | [(); { &loop { break } as *const _ as usize } ];
5-
| ^^^^^^^^^^^^^^
6-
|
7-
= note: see issue #52000 <https://github.com/rust-lang/rust/issues/52000> for more information
8-
= help: add `#![feature(const_loop)]` to the crate attributes to enable
9-
101
error[E0658]: casting pointers to integers in constants is unstable
112
--> $DIR/issue-52442.rs:2:13
123
|
@@ -22,7 +13,7 @@ error[E0080]: evaluation of constant value failed
2213
LL | [(); { &loop { break } as *const _ as usize } ];
2314
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "pointer-to-integer cast" needs an rfc before being allowed inside constants
2415

25-
error: aborting due to 3 previous errors
16+
error: aborting due to 2 previous errors
2617

2718
Some errors have detailed explanations: E0080, E0658.
2819
For more information about an error, try `rustc --explain E0080`.

src/test/ui/consts/const-eval/issue-52475.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ fn main() {
33
let mut x = &0;
44
let mut n = 0;
55
while n < 5 {
6-
//~^ ERROR `while` is not allowed in a `const`
76
n = (n + 1) % 5; //~ ERROR evaluation of constant value failed
87
x = &0; // Materialize a new AllocId
98
}

0 commit comments

Comments
 (0)