Skip to content

Commit 1bcc26a

Browse files
committed
bless tests
1 parent 08ac185 commit 1bcc26a

Some content is hidden

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

55 files changed

+228
-163
lines changed

src/test/ui/const-generics/const_trait_fn-issue-88433.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#![feature(const_trait_impl)]
44

5+
#[const_trait]
56
trait Func<T> {
67
type Output;
78

src/test/ui/const-generics/issues/issue-88119.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#![allow(incomplete_features)]
44
#![feature(const_trait_impl, generic_const_exprs)]
55

6+
#[const_trait]
67
trait ConstName {
78
const NAME_BYTES: &'static [u8];
89
}

src/test/ui/const-generics/issues/issue-98629.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![feature(const_trait_impl)]
22

3+
#[const_trait]
34
trait Trait {
45
const N: usize;
56
}

src/test/ui/const-generics/issues/issue-98629.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0046]: not all trait items implemented, missing: `N`
2-
--> $DIR/issue-98629.rs:7:1
2+
--> $DIR/issue-98629.rs:8:1
33
|
44
LL | const N: usize;
55
| -------------- `N` from trait

src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ error[E0308]: mismatched types
44
LL | = [0; (i8::MAX + 1u8) as usize];
55
| ^^^ expected `i8`, found `u8`
66

7-
error[E0277]: cannot add `u8` to `i8`
7+
error[E0277]: cannot add `u8` to `i8` in const contexts
88
--> $DIR/const-eval-overflow-3b.rs:16:20
99
|
1010
LL | = [0; (i8::MAX + 1u8) as usize];
1111
| ^ no implementation for `i8 + u8`
1212
|
13-
= help: the trait `Add<u8>` is not implemented for `i8`
13+
= help: the trait `~const Add<u8>` is not implemented for `i8`
1414
= help: the following other types implement trait `Add<Rhs>`:
1515
<&'a f32 as Add<f32>>
1616
<&'a f64 as Add<f64>>

src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ error[E0308]: mismatched types
44
LL | : [u32; (i8::MAX as i8 + 1u8) as usize]
55
| ^^^ expected `i8`, found `u8`
66

7-
error[E0277]: cannot add `u8` to `i8`
7+
error[E0277]: cannot add `u8` to `i8` in const contexts
88
--> $DIR/const-eval-overflow-4b.rs:9:28
99
|
1010
LL | : [u32; (i8::MAX as i8 + 1u8) as usize]
1111
| ^ no implementation for `i8 + u8`
1212
|
13-
= help: the trait `Add<u8>` is not implemented for `i8`
13+
= help: the trait `~const Add<u8>` is not implemented for `i8`
1414
= help: the following other types implement trait `Add<Rhs>`:
1515
<&'a f32 as Add<f32>>
1616
<&'a f64 as Add<f64>>

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ const X : usize = 2;
33
const fn f(x: usize) -> usize {
44
let mut sum = 0;
55
for i in 0..x {
6-
//~^ ERROR mutable references
7-
//~| ERROR cannot convert
8-
//~| ERROR cannot call non-const fn
6+
//~^ ERROR the trait bound
97
//~| ERROR `for` is not allowed in a `const fn`
108
sum += i;
119
}

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

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,46 +4,32 @@ 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 | |
97
LL | | sum += i;
108
LL | | }
119
| |_____^
1210
|
1311
= note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
1412
= help: add `#![feature(const_for)]` to the crate attributes to enable
1513

16-
error[E0015]: cannot convert `std::ops::Range<usize>` into an iterator in constant functions
14+
error[E0277]: the trait bound `std::ops::Range<usize>: Iterator` is not satisfied
1715
--> $DIR/const-fn-error.rs:5:14
1816
|
1917
LL | for i in 0..x {
20-
| ^^^^
18+
| ^^^^ `std::ops::Range<usize>` is not an iterator
2119
|
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
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`
3922
--> $DIR/const-fn-error.rs:5:14
4023
|
4124
LL | for i in 0..x {
4225
| ^^^^
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
4328
|
44-
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
29+
LL | const fn f(x: usize) -> usize where std::ops::Range<usize>: ~const Iterator {
30+
| +++++++++++++++++++++++++++++++++++++++++++++
4531

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

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

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

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

89
fn main() {}

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

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@ 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: aborting due to previous error
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
1125

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

0 commit comments

Comments
 (0)