Skip to content

Commit 2412f1b

Browse files
committed
bless ui tests
1 parent 0cd4901 commit 2412f1b

File tree

4 files changed

+34
-5
lines changed

4 files changed

+34
-5
lines changed

tests/ui/consts/const-fn-error.rs

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const fn f(x: usize) -> usize {
77
//~| ERROR `for` is not allowed in a `const fn`
88
//~| ERROR mutable references are not allowed in constant functions
99
//~| ERROR cannot call non-const fn
10+
//~| ERROR the trait bound
1011
sum += i;
1112
}
1213
sum

tests/ui/consts/const-fn-error.stderr

+16-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | / for i in 0..x {
55
LL | |
66
LL | |
77
LL | |
8-
LL | |
8+
... |
99
LL | | sum += i;
1010
LL | | }
1111
| |_____^
@@ -33,6 +33,19 @@ LL | for i in 0..x {
3333
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
3434
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
3535

36+
error[E0277]: the trait bound `std::ops::Range<usize>: Iterator` is not satisfied
37+
--> $DIR/const-fn-error.rs:5:14
38+
|
39+
LL | for i in 0..x {
40+
| ^^^^ `std::ops::Range<usize>` is not an iterator
41+
|
42+
= help: the trait `~const Iterator` is not implemented for `std::ops::Range<usize>`
43+
note: the trait `Iterator` is implemented for `std::ops::Range<usize>`, but that implementation is not `const`
44+
--> $DIR/const-fn-error.rs:5:14
45+
|
46+
LL | for i in 0..x {
47+
| ^^^^
48+
3649
error[E0015]: cannot call non-const fn `<std::ops::Range<usize> as Iterator>::next` in constant functions
3750
--> $DIR/const-fn-error.rs:5:14
3851
|
@@ -42,7 +55,7 @@ LL | for i in 0..x {
4255
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
4356
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
4457

45-
error: aborting due to 4 previous errors
58+
error: aborting due to 5 previous errors
4659

47-
Some errors have detailed explanations: E0015, E0658.
60+
Some errors have detailed explanations: E0015, E0277, E0658.
4861
For more information about an error, try `rustc --explain E0015`.

tests/ui/consts/const-for.rs

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const _: () = {
55
for _ in 0..5 {}
66
//~^ error: cannot call
77
//~| error: cannot convert
8+
//~| error: the trait bound
89
};
910

1011
fn main() {}

tests/ui/consts/const-for.stderr

+16-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@ note: impl defined here, but it is not `const`
99
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
1010
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
1111

12+
error[E0277]: the trait bound `std::ops::Range<i32>: Iterator` is not satisfied
13+
--> $DIR/const-for.rs:5:14
14+
|
15+
LL | for _ in 0..5 {}
16+
| ^^^^ `std::ops::Range<i32>` is not an iterator
17+
|
18+
= help: the trait `~const Iterator` is not implemented for `std::ops::Range<i32>`
19+
note: the trait `Iterator` is implemented for `std::ops::Range<i32>`, but that implementation is not `const`
20+
--> $DIR/const-for.rs:5:14
21+
|
22+
LL | for _ in 0..5 {}
23+
| ^^^^
24+
1225
error[E0015]: cannot call non-const fn `<std::ops::Range<i32> as Iterator>::next` in constants
1326
--> $DIR/const-for.rs:5:14
1427
|
@@ -18,6 +31,7 @@ LL | for _ in 0..5 {}
1831
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
1932
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
2033

21-
error: aborting due to 2 previous errors
34+
error: aborting due to 3 previous errors
2235

23-
For more information about this error, try `rustc --explain E0015`.
36+
Some errors have detailed explanations: E0015, E0277.
37+
For more information about an error, try `rustc --explain E0015`.

0 commit comments

Comments
 (0)