summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2019-12-06 15:37:01 +0900
committerGitHub <noreply@github.com>2019-12-06 15:37:01 +0900
commit3d2cb557340f394463342763e1ee4810f8689ab4 (patch)
tree499f5da976d742078fb94a7c0e41f8344accd20e
parentRollup merge of #66649 - Wind-River:master_xyz, r=alexcrichton (diff)
parentTweak wording of `collect()` on bad target type (diff)
downloadrust-3d2cb557340f394463342763e1ee4810f8689ab4.tar.gz
rust-3d2cb557340f394463342763e1ee4810f8689ab4.tar.bz2
rust-3d2cb557340f394463342763e1ee4810f8689ab4.tar.xz
Rollup merge of #66764 - estebank:reword-bad-collect, r=alexcrichton
Tweak wording of `collect()` on bad target type Fix #60440.
-rw-r--r--src/libcore/iter/traits/collect.rs4
-rw-r--r--src/test/ui/type/type-check-defaults.rs4
-rw-r--r--src/test/ui/type/type-check-defaults.stderr8
-rw-r--r--src/test/ui/type/type-dependent-def-issue-49241.rs2
-rw-r--r--src/test/ui/type/type-dependent-def-issue-49241.stderr4
5 files changed, 11 insertions, 11 deletions
diff --git a/src/libcore/iter/traits/collect.rs b/src/libcore/iter/traits/collect.rs
index bbdb169..d6ae5cf 100644
--- a/src/libcore/iter/traits/collect.rs
+++ b/src/libcore/iter/traits/collect.rs
@@ -91,9 +91,9 @@
91/// ``` 91/// ```
92#[stable(feature = "rust1", since = "1.0.0")] 92#[stable(feature = "rust1", since = "1.0.0")]
93#[rustc_on_unimplemented( 93#[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 \
95 over elements of type `{A}`", 95 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}>`",
97)] 97)]
98pub trait FromIterator<A>: Sized { 98pub trait FromIterator<A>: Sized {
99 /// Creates a value from an iterator. 99 /// Creates a value from an iterator.
diff --git a/src/test/ui/type/type-check-defaults.rs b/src/test/ui/type/type-check-defaults.rs
index 5748c9b..5380fae 100644
--- a/src/test/ui/type/type-check-defaults.rs
+++ b/src/test/ui/type/type-check-defaults.rs
@@ -4,9 +4,9 @@ use std::ops::Add;
4 4
5struct Foo<T, U: FromIterator<T>>(T, U); 5struct Foo<T, U: FromIterator<T>>(T, U);
6struct WellFormed<Z = Foo<i32, i32>>(Z); 6struct 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`
8struct WellFormedNoBounds<Z:?Sized = Foo<i32, i32>>(Z); 8struct 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`
10 10
11struct Bounds<T:Copy=String>(T); 11struct Bounds<T:Copy=String>(T);
12//~^ ERROR the trait bound `std::string::String: std::marker::Copy` is not satisfied [E0277] 12//~^ ERROR the trait bound `std::string::String: std::marker::Copy` is not satisfied [E0277]
diff --git a/src/test/ui/type/type-check-defaults.stderr b/src/test/ui/type/type-check-defaults.stderr
index 6802bc3..6f84b37 100644
--- a/src/test/ui/type/type-check-defaults.stderr
+++ b/src/test/ui/type/type-check-defaults.stderr
@@ -1,21 +1,21 @@
1error[E0277]: a collection of type `i32` cannot be built from an iterator over elements of type `i32` 1error[E0277]: a value of type `i32` cannot be built from an iterator over elements of type `i32`
2 --> $DIR/type-check-defaults.rs:6:19 2 --> $DIR/type-check-defaults.rs:6:19
3 | 3 |
4LL | struct Foo<T, U: FromIterator<T>>(T, U); 4LL | struct Foo<T, U: FromIterator<T>>(T, U);
5 | ---------------------------------------- required by `Foo` 5 | ---------------------------------------- required by `Foo`
6LL | struct WellFormed<Z = Foo<i32, i32>>(Z); 6LL | 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>`
8 | 8 |
9 = help: the trait `std::iter::FromIterator<i32>` is not implemented for `i32` 9 = help: the trait `std::iter::FromIterator<i32>` is not implemented for `i32`
10 10
11error[E0277]: a collection of type `i32` cannot be built from an iterator over elements of type `i32` 11error[E0277]: a value of type `i32` cannot be built from an iterator over elements of type `i32`
12 --> $DIR/type-check-defaults.rs:8:27 12 --> $DIR/type-check-defaults.rs:8:27
13 | 13 |
14LL | struct Foo<T, U: FromIterator<T>>(T, U); 14LL | struct Foo<T, U: FromIterator<T>>(T, U);
15 | ---------------------------------------- required by `Foo` 15 | ---------------------------------------- required by `Foo`
16... 16...
17LL | struct WellFormedNoBounds<Z:?Sized = Foo<i32, i32>>(Z); 17LL | 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>`
19 | 19 |
20 = help: the trait `std::iter::FromIterator<i32>` is not implemented for `i32` 20 = help: the trait `std::iter::FromIterator<i32>` is not implemented for `i32`
21 21
diff --git a/src/test/ui/type/type-dependent-def-issue-49241.rs b/src/test/ui/type/type-dependent-def-issue-49241.rs
index 5ad50ff..a25e3ba 100644
--- a/src/test/ui/type/type-dependent-def-issue-49241.rs
+++ b/src/test/ui/type/type-dependent-def-issue-49241.rs
@@ -3,5 +3,5 @@ fn main() {
3 const l: usize = v.count(); //~ ERROR attempt to use a non-constant value in a constant 3 const l: usize = v.count(); //~ ERROR attempt to use a non-constant value in a constant
4 let s: [u32; l] = v.into_iter().collect(); 4 let s: [u32; l] = v.into_iter().collect();
5 //~^ ERROR evaluation of constant value failed 5 //~^ ERROR evaluation of constant value failed
6 //~^^ ERROR a collection of type 6 //~^^ ERROR a value of type
7} 7}
diff --git a/src/test/ui/type/type-dependent-def-issue-49241.stderr b/src/test/ui/type/type-dependent-def-issue-49241.stderr
index 851004d..18a69c5 100644
--- a/src/test/ui/type/type-dependent-def-issue-49241.stderr
+++ b/src/test/ui/type/type-dependent-def-issue-49241.stderr
@@ -10,11 +10,11 @@ error[E0080]: evaluation of constant value failed
10LL | let s: [u32; l] = v.into_iter().collect(); 10LL | let s: [u32; l] = v.into_iter().collect();
11 | ^ referenced constant has errors 11 | ^ referenced constant has errors
12 12
13error[E0277]: a collection of type `[u32; _]` cannot be built from an iterator over elements of type `{integer}` 13error[E0277]: a value of type `[u32; _]` cannot be built from an iterator over elements of type `{integer}`
14 --> $DIR/type-dependent-def-issue-49241.rs:4:37 14 --> $DIR/type-dependent-def-issue-49241.rs:4:37
15 | 15 |
16LL | let s: [u32; l] = v.into_iter().collect(); 16LL | 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}>`
18 | 18 |
19 = help: the trait `std::iter::FromIterator<{integer}>` is not implemented for `[u32; _]` 19 = help: the trait `std::iter::FromIterator<{integer}>` is not implemented for `[u32; _]`
20 20