Skip to content

Commit edd4b36

Browse files
Update tests
1 parent ff0096d commit edd4b36

File tree

78 files changed

+228
-1192
lines changed

Some content is hidden

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

78 files changed

+228
-1192
lines changed

src/test/ui/array-slice-vec/subslice-patterns-const-eval-match.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
// run-pass
44

5-
#![feature(const_fn, const_if_match)]
5+
#![feature(const_fn)]
6+
67
#[derive(PartialEq, Debug, Clone)]
78
struct N(u8);
89

src/test/ui/borrowck/issue-64453.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ struct Project;
22
struct Value;
33

44
static settings_dir: String = format!("");
5-
//~^ ERROR `match` is not allowed in a `static`
5+
//~^ ERROR calls in statics are limited to constant functions
6+
//~| ERROR calls in statics are limited to constant functions
67

78
fn from_string(_: String) -> Value {
89
Value
@@ -11,6 +12,7 @@ fn set_editor(_: Value) {}
1112

1213
fn main() {
1314
let settings_data = from_string(settings_dir);
15+
//~^ ERROR cannot move out of static item
1416
let args: i32 = 0;
1517

1618
match args {
Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
1-
error[E0658]: `match` is not allowed in a `static`
1+
error[E0507]: cannot move out of static item `settings_dir`
2+
--> $DIR/issue-64453.rs:14:37
3+
|
4+
LL | let settings_data = from_string(settings_dir);
5+
| ^^^^^^^^^^^^ move occurs because `settings_dir` has type `std::string::String`, which does not implement the `Copy` trait
6+
7+
error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
8+
--> $DIR/issue-64453.rs:4:31
9+
|
10+
LL | static settings_dir: String = format!("");
11+
| ^^^^^^^^^^^
12+
|
13+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
14+
15+
error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
216
--> $DIR/issue-64453.rs:4:31
317
|
418
LL | static settings_dir: String = format!("");
519
| ^^^^^^^^^^^
620
|
7-
= note: see issue #49146 <https://github.com/rust-lang/rust/issues/49146> for more information
8-
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
921
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
1022

11-
error: aborting due to previous error
23+
error: aborting due to 3 previous errors
1224

13-
For more information about this error, try `rustc --explain E0658`.
25+
Some errors have detailed explanations: E0015, E0507.
26+
For more information about an error, try `rustc --explain E0015`.

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ fn main() {
77
//~^ ERROR `while` is not allowed in a `const`
88
n = if n % 2 == 0 { n/2 } else { 3*n + 1 };
99
//~^ ERROR evaluation of constant value failed
10-
//~| ERROR `if` is not allowed in a `const`
1110
}
1211
n
1312
}];

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

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,19 @@ LL | / while n != 0 {
55
LL | |
66
LL | | n = if n % 2 == 0 { n/2 } else { 3*n + 1 };
77
LL | |
8-
LL | |
98
LL | | }
109
| |_________^
1110
|
1211
= note: see issue #52000 <https://github.com/rust-lang/rust/issues/52000> for more information
1312
= help: add `#![feature(const_loop)]` to the crate attributes to enable
14-
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
15-
16-
error[E0658]: `if` is not allowed in a `const`
17-
--> $DIR/infinite_loop.rs:8:17
18-
|
19-
LL | n = if n % 2 == 0 { n/2 } else { 3*n + 1 };
20-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21-
|
22-
= note: see issue #49146 <https://github.com/rust-lang/rust/issues/49146> for more information
23-
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
2413

2514
error[E0080]: evaluation of constant value failed
2615
--> $DIR/infinite_loop.rs:8:17
2716
|
2817
LL | n = if n % 2 == 0 { n/2 } else { 3*n + 1 };
2918
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`)
3019

31-
error: aborting due to 3 previous errors
20+
error: aborting due to 2 previous errors
3221

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

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ LL | | }
1010
|
1111
= note: see issue #52000 <https://github.com/rust-lang/rust/issues/52000> for more information
1212
= help: add `#![feature(const_loop)]` to the crate attributes to enable
13-
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
1413

1514
error[E0080]: evaluation of constant value failed
1615
--> $DIR/issue-52475.rs:7:17

src/test/ui/consts/const-eval/match-test-ptr-null.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ fn main() {
55
let _: [u8; 0] = [4; {
66
match &1 as *const i32 as usize {
77
//~^ ERROR casting pointers to integers in constants
8-
//~| ERROR `match` is not allowed in a `const`
98
//~| ERROR evaluation of constant value failed
109
0 => 42,
1110
n => n,
Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
1-
error[E0658]: `match` is not allowed in a `const`
2-
--> $DIR/match-test-ptr-null.rs:6:9
3-
|
4-
LL | / match &1 as *const i32 as usize {
5-
LL | |
6-
LL | |
7-
LL | |
8-
LL | | 0 => 42,
9-
LL | | n => n,
10-
LL | | }
11-
| |_________^
12-
|
13-
= note: see issue #49146 <https://github.com/rust-lang/rust/issues/49146> for more information
14-
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
15-
161
error[E0658]: casting pointers to integers in constants is unstable
172
--> $DIR/match-test-ptr-null.rs:6:15
183
|
@@ -28,7 +13,7 @@ error[E0080]: evaluation of constant value failed
2813
LL | match &1 as *const i32 as usize {
2914
| ^^^^^^^^^^^^^^^^^^^^^^^^^ "pointer-to-integer cast" needs an rfc before being allowed inside constants
3015

31-
error: aborting due to 3 previous errors
16+
error: aborting due to 2 previous errors
3217

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

src/test/ui/consts/const-labeled-break.stderr

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ LL | const CRASH: () = 'a: while break 'a {};
66
|
77
= note: see issue #52000 <https://github.com/rust-lang/rust/issues/52000> for more information
88
= help: add `#![feature(const_loop)]` to the crate attributes to enable
9-
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
109

1110
error: aborting due to previous error
1211

src/test/ui/consts/const-match-pattern-arm.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#![allow(warnings)]
1+
// check-pass
22

3-
const x: bool = match Some(true) { //~ ERROR `match` is not allowed in a `const`
3+
const _: bool = match Some(true) {
44
Some(value) => true,
55
_ => false
66
};
77

8-
const y: bool = {
9-
match Some(true) { //~ ERROR `match` is not allowed in a `const`
8+
const _: bool = {
9+
match Some(true) {
1010
Some(value) => true,
1111
_ => false
1212
}

src/test/ui/consts/const-match-pattern-arm.stderr

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/test/ui/consts/const_in_pattern/custom-eq-branch-pass.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// run-pass
22

3-
#![feature(const_if_match)]
43
#![warn(indirect_structural_match)]
54

65
struct CustomEq;

src/test/ui/consts/const_in_pattern/custom-eq-branch-warn.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// check-pass
22

3-
#![feature(const_if_match)]
43
#![warn(indirect_structural_match)]
54
//~^ NOTE lint level is defined here
65

src/test/ui/consts/const_in_pattern/custom-eq-branch-warn.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
warning: to use a constant of type `CustomEq` in a pattern, `CustomEq` must be annotated with `#[derive(PartialEq, Eq)]`
2-
--> $DIR/custom-eq-branch-warn.rs:33:9
2+
--> $DIR/custom-eq-branch-warn.rs:32:9
33
|
44
LL | BAR_BAZ => panic!(),
55
| ^^^^^^^
66
|
77
note: the lint level is defined here
8-
--> $DIR/custom-eq-branch-warn.rs:4:9
8+
--> $DIR/custom-eq-branch-warn.rs:3:9
99
|
1010
LL | #![warn(indirect_structural_match)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^

src/test/ui/consts/const_in_pattern/no-eq-branch-fail.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(const_if_match)]
21
#![warn(indirect_structural_match)]
32

43
struct NoEq;

src/test/ui/consts/const_in_pattern/no-eq-branch-fail.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]`
2-
--> $DIR/no-eq-branch-fail.rs:22:9
2+
--> $DIR/no-eq-branch-fail.rs:21:9
33
|
44
LL | BAR_BAZ => panic!(),
55
| ^^^^^^^
66

77
error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]`
8-
--> $DIR/no-eq-branch-fail.rs:22:9
8+
--> $DIR/no-eq-branch-fail.rs:21:9
99
|
1010
LL | BAR_BAZ => panic!(),
1111
| ^^^^^^^

src/test/ui/consts/const_let_refutable.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ fn main() {}
22

33
const fn slice(&[a, b]: &[i32]) -> i32 {
44
//~^ ERROR refutable pattern in function argument
5-
//~| ERROR loops and conditional expressions are not stable in const fn
65
a + b
76
}

src/test/ui/consts/const_let_refutable.stderr

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,6 @@ LL | const fn slice(&[a, b]: &[i32]) -> i32 {
66
|
77
= note: the matched value is of type `&[i32]`
88

9-
error[E0723]: loops and conditional expressions are not stable in const fn
10-
--> $DIR/const_let_refutable.rs:3:17
11-
|
12-
LL | const fn slice(&[a, b]: &[i32]) -> i32 {
13-
| ^^^^^^
14-
|
15-
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
16-
= help: add `#![feature(const_fn)]` to the crate attributes to enable
17-
18-
error: aborting due to 2 previous errors
9+
error: aborting due to previous error
1910

20-
Some errors have detailed explanations: E0005, E0723.
21-
For more information about an error, try `rustc --explain E0005`.
11+
For more information about this error, try `rustc --explain E0005`.

src/test/ui/consts/const_limit/const_eval_limit_not_reached.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// check-pass
22

33
#![feature(const_eval_limit)]
4-
#![feature(const_loop, const_if_match)]
4+
#![feature(const_loop)]
55

66
// This needs to be higher than the number of loop iterations since each pass through the loop may
77
// hit more than one terminator.

src/test/ui/consts/const_limit/const_eval_limit_reached.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#![feature(const_eval_limit)]
2-
#![feature(const_loop, const_if_match)]
3-
4-
#![const_eval_limit="500"]
2+
#![feature(const_loop)]
3+
#![const_eval_limit = "500"]
54

65
const X: usize = {
76
let mut x = 0;

src/test/ui/consts/const_limit/const_eval_limit_reached.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: any use of this value will cause an error
2-
--> $DIR/const_eval_limit_reached.rs:8:5
2+
--> $DIR/const_eval_limit_reached.rs:7:11
33
|
44
LL | / const X: usize = {
55
LL | | let mut x = 0;

src/test/ui/consts/const_short_circuit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1+
// check-pass
2+
13
const _: bool = false && false;
24
const _: bool = true && false;
35
const _: bool = {
46
let mut x = true && false;
5-
//~^ ERROR new features like let bindings are not permitted
67
x
78
};
89
const _: bool = {
910
let x = true && false;
10-
//~^ ERROR new features like let bindings are not permitted
1111
x
1212
};
1313

src/test/ui/consts/const_short_circuit.stderr

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/test/ui/consts/control-flow/assert.both.stderr

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/test/ui/consts/control-flow/assert.if_match.stderr

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)