Skip to content

Commit 3d2cb55

Browse files
authored
Rollup merge of #66764 - estebank:reword-bad-collect, r=alexcrichton
Tweak wording of `collect()` on bad target type Fix #60440.
2 parents 617b07e + 3091b82 commit 3d2cb55

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

src/libcore/iter/traits/collect.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@
9191
/// ```
9292
#[stable(feature = "rust1", since = "1.0.0")]
9393
#[rustc_on_unimplemented(
94-
message="a collection of type `{Self}` cannot be built from an iterator \
94+
message="a value of type `{Self}` cannot be built from an iterator \
9595
over elements of type `{A}`",
96-
label="a collection of type `{Self}` cannot be built from `std::iter::Iterator<Item={A}>`",
96+
label="value of type `{Self}` cannot be built from `std::iter::Iterator<Item={A}>`",
9797
)]
9898
pub trait FromIterator<A>: Sized {
9999
/// Creates a value from an iterator.

src/test/ui/type/type-check-defaults.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ use std::ops::Add;
44

55
struct Foo<T, U: FromIterator<T>>(T, U);
66
struct WellFormed<Z = Foo<i32, i32>>(Z);
7-
//~^ ERROR a collection of type `i32` cannot be built from an iterator over elements of type `i32`
7+
//~^ ERROR a value of type `i32` cannot be built from an iterator over elements of type `i32`
88
struct WellFormedNoBounds<Z:?Sized = Foo<i32, i32>>(Z);
9-
//~^ ERROR a collection of type `i32` cannot be built from an iterator over elements of type `i32`
9+
//~^ ERROR a value of type `i32` cannot be built from an iterator over elements of type `i32`
1010

1111
struct Bounds<T:Copy=String>(T);
1212
//~^ ERROR the trait bound `std::string::String: std::marker::Copy` is not satisfied [E0277]

src/test/ui/type/type-check-defaults.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
error[E0277]: a collection of type `i32` cannot be built from an iterator over elements of type `i32`
1+
error[E0277]: a value of type `i32` cannot be built from an iterator over elements of type `i32`
22
--> $DIR/type-check-defaults.rs:6:19
33
|
44
LL | struct Foo<T, U: FromIterator<T>>(T, U);
55
| ---------------------------------------- required by `Foo`
66
LL | struct WellFormed<Z = Foo<i32, i32>>(Z);
7-
| ^ a collection of type `i32` cannot be built from `std::iter::Iterator<Item=i32>`
7+
| ^ value of type `i32` cannot be built from `std::iter::Iterator<Item=i32>`
88
|
99
= help: the trait `std::iter::FromIterator<i32>` is not implemented for `i32`
1010

11-
error[E0277]: a collection of type `i32` cannot be built from an iterator over elements of type `i32`
11+
error[E0277]: a value of type `i32` cannot be built from an iterator over elements of type `i32`
1212
--> $DIR/type-check-defaults.rs:8:27
1313
|
1414
LL | struct Foo<T, U: FromIterator<T>>(T, U);
1515
| ---------------------------------------- required by `Foo`
1616
...
1717
LL | struct WellFormedNoBounds<Z:?Sized = Foo<i32, i32>>(Z);
18-
| ^ a collection of type `i32` cannot be built from `std::iter::Iterator<Item=i32>`
18+
| ^ value of type `i32` cannot be built from `std::iter::Iterator<Item=i32>`
1919
|
2020
= help: the trait `std::iter::FromIterator<i32>` is not implemented for `i32`
2121

src/test/ui/type/type-dependent-def-issue-49241.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ fn main() {
33
const l: usize = v.count(); //~ ERROR attempt to use a non-constant value in a constant
44
let s: [u32; l] = v.into_iter().collect();
55
//~^ ERROR evaluation of constant value failed
6-
//~^^ ERROR a collection of type
6+
//~^^ ERROR a value of type
77
}

src/test/ui/type/type-dependent-def-issue-49241.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ error[E0080]: evaluation of constant value failed
1010
LL | let s: [u32; l] = v.into_iter().collect();
1111
| ^ referenced constant has errors
1212

13-
error[E0277]: a collection of type `[u32; _]` cannot be built from an iterator over elements of type `{integer}`
13+
error[E0277]: a value of type `[u32; _]` cannot be built from an iterator over elements of type `{integer}`
1414
--> $DIR/type-dependent-def-issue-49241.rs:4:37
1515
|
1616
LL | let s: [u32; l] = v.into_iter().collect();
17-
| ^^^^^^^ a collection of type `[u32; _]` cannot be built from `std::iter::Iterator<Item={integer}>`
17+
| ^^^^^^^ value of type `[u32; _]` cannot be built from `std::iter::Iterator<Item={integer}>`
1818
|
1919
= help: the trait `std::iter::FromIterator<{integer}>` is not implemented for `[u32; _]`
2020

0 commit comments

Comments
 (0)