Skip to content

Commit f937a10

Browse files
committed
Bless ui tests after typeck code change
1 parent f8813cf commit f937a10

16 files changed

+101
-123
lines changed

src/test/ui/consts/const-fn-error.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ const X : usize = 2;
33
const fn f(x: usize) -> usize {
44
let mut sum = 0;
55
for i in 0..x {
6-
//~^ ERROR the trait bound
6+
//~^ ERROR cannot convert
77
//~| ERROR `for` is not allowed in a `const fn`
8+
//~| ERROR mutable references are not allowed in constant functions
9+
//~| ERROR cannot call non-const fn
810
sum += i;
911
}
1012
sum

src/test/ui/consts/const-fn-error.stderr

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,46 @@ error[E0658]: `for` is not allowed in a `const fn`
44
LL | / for i in 0..x {
55
LL | |
66
LL | |
7+
LL | |
8+
LL | |
79
LL | | sum += i;
810
LL | | }
911
| |_____^
1012
|
1113
= note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
1214
= help: add `#![feature(const_for)]` to the crate attributes to enable
1315

14-
error[E0277]: the trait bound `std::ops::Range<usize>: Iterator` is not satisfied
16+
error[E0015]: cannot convert `std::ops::Range<usize>` into an iterator in constant functions
1517
--> $DIR/const-fn-error.rs:5:14
1618
|
1719
LL | for i in 0..x {
18-
| ^^^^ `std::ops::Range<usize>` is not an iterator
20+
| ^^^^
1921
|
20-
= help: the trait `~const Iterator` is not implemented for `std::ops::Range<usize>`
21-
note: the trait `Iterator` is implemented for `std::ops::Range<usize>`, but that implementation is not `const`
22+
note: impl defined here, but it is not `const`
23+
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
24+
|
25+
LL | impl<I: ~const Iterator> const IntoIterator for I {
26+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
27+
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
28+
29+
error[E0658]: mutable references are not allowed in constant functions
30+
--> $DIR/const-fn-error.rs:5:14
31+
|
32+
LL | for i in 0..x {
33+
| ^^^^
34+
|
35+
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
36+
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
37+
38+
error[E0015]: cannot call non-const fn `<std::ops::Range<usize> as Iterator>::next` in constant functions
2239
--> $DIR/const-fn-error.rs:5:14
2340
|
2441
LL | for i in 0..x {
2542
| ^^^^
26-
= note: required for `std::ops::Range<usize>` to implement `~const IntoIterator`
27-
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
2843
|
29-
LL | const fn f(x: usize) -> usize where std::ops::Range<usize>: ~const Iterator {
30-
| +++++++++++++++++++++++++++++++++++++++++++++
44+
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
3145

32-
error: aborting due to 2 previous errors
46+
error: aborting due to 4 previous errors
3347

34-
Some errors have detailed explanations: E0277, E0658.
35-
For more information about an error, try `rustc --explain E0277`.
48+
Some errors have detailed explanations: E0015, E0658.
49+
For more information about an error, try `rustc --explain E0015`.

src/test/ui/consts/const-for-feature-gate.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
const _: () = {
44
for _ in 0..5 {}
55
//~^ error: `for` is not allowed in a `const`
6-
//~| error: the trait bound
76
};
87

98
fn main() {}

src/test/ui/consts/const-for-feature-gate.stderr

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,6 @@ LL | for _ in 0..5 {}
77
= note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
88
= help: add `#![feature(const_for)]` to the crate attributes to enable
99

10-
error[E0277]: the trait bound `std::ops::Range<{integer}>: Iterator` is not satisfied
11-
--> $DIR/const-for-feature-gate.rs:4:14
12-
|
13-
LL | for _ in 0..5 {}
14-
| ^^^^ `std::ops::Range<{integer}>` is not an iterator
15-
|
16-
= help: the trait `~const Iterator` is not implemented for `std::ops::Range<{integer}>`
17-
note: the trait `Iterator` is implemented for `std::ops::Range<{integer}>`, but that implementation is not `const`
18-
--> $DIR/const-for-feature-gate.rs:4:14
19-
|
20-
LL | for _ in 0..5 {}
21-
| ^^^^
22-
= note: required for `std::ops::Range<{integer}>` to implement `~const IntoIterator`
23-
24-
error: aborting due to 2 previous errors
10+
error: aborting due to previous error
2511

26-
Some errors have detailed explanations: E0277, E0658.
27-
For more information about an error, try `rustc --explain E0277`.
12+
For more information about this error, try `rustc --explain E0658`.

src/test/ui/consts/const-for.rs

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

44
const _: () = {
55
for _ in 0..5 {}
6-
//~^ error: the trait bound
6+
//~^ error: cannot call
7+
//~| error: cannot convert
78
};
89

910
fn main() {}

src/test/ui/consts/const-for.stderr

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
1-
error[E0277]: the trait bound `std::ops::Range<{integer}>: Iterator` is not satisfied
1+
error[E0015]: cannot convert `std::ops::Range<i32>` into an iterator in constants
22
--> $DIR/const-for.rs:5:14
33
|
44
LL | for _ in 0..5 {}
5-
| ^^^^ `std::ops::Range<{integer}>` is not an iterator
5+
| ^^^^
6+
|
7+
note: impl defined here, but it is not `const`
8+
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
69
|
7-
= help: the trait `~const Iterator` is not implemented for `std::ops::Range<{integer}>`
8-
note: the trait `Iterator` is implemented for `std::ops::Range<{integer}>`, but that implementation is not `const`
10+
LL | impl<I: ~const Iterator> const IntoIterator for I {
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
13+
14+
error[E0015]: cannot call non-const fn `<std::ops::Range<i32> as Iterator>::next` in constants
915
--> $DIR/const-for.rs:5:14
1016
|
1117
LL | for _ in 0..5 {}
1218
| ^^^^
13-
= note: required for `std::ops::Range<{integer}>` to implement `~const IntoIterator`
19+
|
20+
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
1421

15-
error: aborting due to previous error
22+
error: aborting due to 2 previous errors
1623

17-
For more information about this error, try `rustc --explain E0277`.
24+
For more information about this error, try `rustc --explain E0015`.

src/test/ui/consts/control-flow/loop.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,10 @@ const _: i32 = {
5151
let mut x = 0;
5252

5353
for i in 0..4 { //~ ERROR `for` is not allowed in a `const`
54-
//~^ ERROR the trait bound
5554
x += i;
5655
}
5756

5857
for i in 0..4 { //~ ERROR `for` is not allowed in a `const`
59-
//~^ ERROR the trait bound
6058
x += i;
6159
}
6260

src/test/ui/consts/control-flow/loop.stderr

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ error[E0658]: `for` is not allowed in a `const`
22
--> $DIR/loop.rs:53:5
33
|
44
LL | / for i in 0..4 {
5-
LL | |
65
LL | | x += i;
76
LL | | }
87
| |_____^
@@ -11,46 +10,16 @@ LL | | }
1110
= help: add `#![feature(const_for)]` to the crate attributes to enable
1211

1312
error[E0658]: `for` is not allowed in a `const`
14-
--> $DIR/loop.rs:58:5
13+
--> $DIR/loop.rs:57:5
1514
|
1615
LL | / for i in 0..4 {
17-
LL | |
1816
LL | | x += i;
1917
LL | | }
2018
| |_____^
2119
|
2220
= note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
2321
= help: add `#![feature(const_for)]` to the crate attributes to enable
2422

25-
error[E0277]: the trait bound `std::ops::Range<{integer}>: Iterator` is not satisfied
26-
--> $DIR/loop.rs:53:14
27-
|
28-
LL | for i in 0..4 {
29-
| ^^^^ `std::ops::Range<{integer}>` is not an iterator
30-
|
31-
= help: the trait `~const Iterator` is not implemented for `std::ops::Range<{integer}>`
32-
note: the trait `Iterator` is implemented for `std::ops::Range<{integer}>`, but that implementation is not `const`
33-
--> $DIR/loop.rs:53:14
34-
|
35-
LL | for i in 0..4 {
36-
| ^^^^
37-
= note: required for `std::ops::Range<{integer}>` to implement `~const IntoIterator`
38-
39-
error[E0277]: the trait bound `std::ops::Range<{integer}>: Iterator` is not satisfied
40-
--> $DIR/loop.rs:58:14
41-
|
42-
LL | for i in 0..4 {
43-
| ^^^^ `std::ops::Range<{integer}>` is not an iterator
44-
|
45-
= help: the trait `~const Iterator` is not implemented for `std::ops::Range<{integer}>`
46-
note: the trait `Iterator` is implemented for `std::ops::Range<{integer}>`, but that implementation is not `const`
47-
--> $DIR/loop.rs:58:14
48-
|
49-
LL | for i in 0..4 {
50-
| ^^^^
51-
= note: required for `std::ops::Range<{integer}>` to implement `~const IntoIterator`
52-
53-
error: aborting due to 4 previous errors
23+
error: aborting due to 2 previous errors
5424

55-
Some errors have detailed explanations: E0277, E0658.
56-
For more information about an error, try `rustc --explain E0277`.
25+
For more information about this error, try `rustc --explain E0658`.

src/test/ui/issues/issue-50582.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ fn main() {
22
Vec::<[(); 1 + for x in 0..1 {}]>::new();
33
//~^ ERROR cannot add
44
//~| ERROR `for` is not allowed in a `const`
5-
//~| ERROR the trait bound
65
}

src/test/ui/issues/issue-50582.stderr

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,6 @@ LL | Vec::<[(); 1 + for x in 0..1 {}]>::new();
77
= note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
88
= help: add `#![feature(const_for)]` to the crate attributes to enable
99

10-
error[E0277]: the trait bound `std::ops::Range<{integer}>: Iterator` is not satisfied
11-
--> $DIR/issue-50582.rs:2:29
12-
|
13-
LL | Vec::<[(); 1 + for x in 0..1 {}]>::new();
14-
| ^^^^ `std::ops::Range<{integer}>` is not an iterator
15-
|
16-
= help: the trait `~const Iterator` is not implemented for `std::ops::Range<{integer}>`
17-
note: the trait `Iterator` is implemented for `std::ops::Range<{integer}>`, but that implementation is not `const`
18-
--> $DIR/issue-50582.rs:2:29
19-
|
20-
LL | Vec::<[(); 1 + for x in 0..1 {}]>::new();
21-
| ^^^^
22-
= note: required for `std::ops::Range<{integer}>` to implement `~const IntoIterator`
23-
2410
error[E0277]: cannot add `()` to `{integer}` in const contexts
2511
--> $DIR/issue-50582.rs:2:18
2612
|
@@ -39,7 +25,7 @@ LL | Vec::<[(); 1 + for x in 0..1 {}]>::new();
3925
<&'a isize as Add<isize>>
4026
and 48 others
4127

42-
error: aborting due to 3 previous errors
28+
error: aborting due to 2 previous errors
4329

4430
Some errors have detailed explanations: E0277, E0658.
4531
For more information about an error, try `rustc --explain E0277`.

src/test/ui/issues/issue-50585.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ fn main() {
22
|y: Vec<[(); for x in 0..2 {}]>| {};
33
//~^ ERROR mismatched types
44
//~| ERROR `for` is not allowed in a `const`
5-
//~| ERROR the trait bound
65
}

src/test/ui/issues/issue-50585.stderr

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,13 @@ LL | |y: Vec<[(); for x in 0..2 {}]>| {};
77
= note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
88
= help: add `#![feature(const_for)]` to the crate attributes to enable
99

10-
error[E0277]: the trait bound `std::ops::Range<{integer}>: Iterator` is not satisfied
11-
--> $DIR/issue-50585.rs:2:27
12-
|
13-
LL | |y: Vec<[(); for x in 0..2 {}]>| {};
14-
| ^^^^ `std::ops::Range<{integer}>` is not an iterator
15-
|
16-
= help: the trait `~const Iterator` is not implemented for `std::ops::Range<{integer}>`
17-
note: the trait `Iterator` is implemented for `std::ops::Range<{integer}>`, but that implementation is not `const`
18-
--> $DIR/issue-50585.rs:2:27
19-
|
20-
LL | |y: Vec<[(); for x in 0..2 {}]>| {};
21-
| ^^^^
22-
= note: required for `std::ops::Range<{integer}>` to implement `~const IntoIterator`
23-
2410
error[E0308]: mismatched types
2511
--> $DIR/issue-50585.rs:2:18
2612
|
2713
LL | |y: Vec<[(); for x in 0..2 {}]>| {};
2814
| ^^^^^^^^^^^^^^^^ expected `usize`, found `()`
2915

30-
error: aborting due to 3 previous errors
16+
error: aborting due to 2 previous errors
3117

32-
Some errors have detailed explanations: E0277, E0308, E0658.
33-
For more information about an error, try `rustc --explain E0277`.
18+
Some errors have detailed explanations: E0308, E0658.
19+
For more information about an error, try `rustc --explain E0308`.

src/test/ui/never_type/issue-52443.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@ fn main() {
88

99
[(); { for _ in 0usize.. {}; 0}];
1010
//~^ ERROR `for` is not allowed in a `const`
11-
//~| ERROR the trait bound
11+
//~| ERROR cannot convert
12+
//~| ERROR mutable references
13+
//~| ERROR cannot call
1214
}

src/test/ui/never_type/issue-52443.stderr

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,37 @@ LL | [(); loop { break }];
3838
| expected `usize`, found `()`
3939
| help: give it a value of the expected type: `break 42`
4040

41-
error[E0277]: the trait bound `RangeFrom<usize>: Iterator` is not satisfied
41+
error[E0015]: cannot convert `RangeFrom<usize>` into an iterator in constants
4242
--> $DIR/issue-52443.rs:9:21
4343
|
4444
LL | [(); { for _ in 0usize.. {}; 0}];
45-
| ^^^^^^^^ `RangeFrom<usize>` is not an iterator
45+
| ^^^^^^^^
46+
|
47+
note: impl defined here, but it is not `const`
48+
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
49+
|
50+
LL | impl<I: ~const Iterator> const IntoIterator for I {
51+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
52+
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
53+
54+
error[E0658]: mutable references are not allowed in constants
55+
--> $DIR/issue-52443.rs:9:21
4656
|
47-
= help: the trait `~const Iterator` is not implemented for `RangeFrom<usize>`
48-
note: the trait `Iterator` is implemented for `RangeFrom<usize>`, but that implementation is not `const`
57+
LL | [(); { for _ in 0usize.. {}; 0}];
58+
| ^^^^^^^^
59+
|
60+
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
61+
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
62+
63+
error[E0015]: cannot call non-const fn `<RangeFrom<usize> as Iterator>::next` in constants
4964
--> $DIR/issue-52443.rs:9:21
5065
|
5166
LL | [(); { for _ in 0usize.. {}; 0}];
5267
| ^^^^^^^^
53-
= note: required for `RangeFrom<usize>` to implement `~const IntoIterator`
54-
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
5568
|
56-
LL | fn main() where RangeFrom<usize>: ~const Iterator {
57-
| +++++++++++++++++++++++++++++++++++++++
69+
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
5870

59-
error: aborting due to 4 previous errors; 1 warning emitted
71+
error: aborting due to 6 previous errors; 1 warning emitted
6072

61-
Some errors have detailed explanations: E0277, E0308, E0658.
62-
For more information about an error, try `rustc --explain E0277`.
73+
Some errors have detailed explanations: E0015, E0308, E0658.
74+
For more information about an error, try `rustc --explain E0015`.

src/test/ui/ufcs/ufcs-qpath-self-mismatch.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ fn main() {
44
<i32 as Add<u32>>::add(1, 2);
55
//~^ ERROR cannot add `u32` to `i32`
66
//~| ERROR cannot add `u32` to `i32`
7+
//~| ERROR cannot add `u32` to `i32`
78
<i32 as Add<i32>>::add(1u32, 2);
89
//~^ ERROR mismatched types
910
<i32 as Add<i32>>::add(1, 2u32);

src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,26 @@ LL | <i32 as Add<u32>>::add(1, 2);
1818
<&'a isize as Add<isize>>
1919
and 48 others
2020

21+
error[E0277]: cannot add `u32` to `i32`
22+
--> $DIR/ufcs-qpath-self-mismatch.rs:4:5
23+
|
24+
LL | <i32 as Add<u32>>::add(1, 2);
25+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `i32 + u32`
26+
|
27+
= help: the trait `Add<u32>` is not implemented for `i32`
28+
= help: the following other types implement trait `Add<Rhs>`:
29+
<&'a f32 as Add<f32>>
30+
<&'a f64 as Add<f64>>
31+
<&'a i128 as Add<i128>>
32+
<&'a i16 as Add<i16>>
33+
<&'a i32 as Add<i32>>
34+
<&'a i64 as Add<i64>>
35+
<&'a i8 as Add<i8>>
36+
<&'a isize as Add<isize>>
37+
and 48 others
38+
2139
error[E0308]: mismatched types
22-
--> $DIR/ufcs-qpath-self-mismatch.rs:7:28
40+
--> $DIR/ufcs-qpath-self-mismatch.rs:8:28
2341
|
2442
LL | <i32 as Add<i32>>::add(1u32, 2);
2543
| ---------------------- ^^^^ expected `i32`, found `u32`
@@ -37,7 +55,7 @@ LL | <i32 as Add<i32>>::add(1i32, 2);
3755
| ~~~
3856

3957
error[E0308]: mismatched types
40-
--> $DIR/ufcs-qpath-self-mismatch.rs:9:31
58+
--> $DIR/ufcs-qpath-self-mismatch.rs:10:31
4159
|
4260
LL | <i32 as Add<i32>>::add(1, 2u32);
4361
| ---------------------- ^^^^ expected `i32`, found `u32`
@@ -72,7 +90,7 @@ LL | <i32 as Add<u32>>::add(1, 2);
7290
<&'a isize as Add<isize>>
7391
and 48 others
7492

75-
error: aborting due to 4 previous errors
93+
error: aborting due to 5 previous errors
7694

7795
Some errors have detailed explanations: E0277, E0308.
7896
For more information about an error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)