From 3091b823d1080cfd2851f13b2eed5deed20d5f67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Mon, 25 Nov 2019 18:31:27 -0800 Subject: [PATCH] Tweak wording of `collect()` on bad target type --- src/libcore/iter/traits/collect.rs | 4 ++-- src/test/ui/type/type-check-defaults.rs | 4 ++-- src/test/ui/type/type-check-defaults.stderr | 8 ++++---- src/test/ui/type/type-dependent-def-issue-49241.rs | 2 +- src/test/ui/type/type-dependent-def-issue-49241.stderr | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/libcore/iter/traits/collect.rs b/src/libcore/iter/traits/collect.rs index bbdb169cac0fc..d6ae5cfe9e00e 100644 --- a/src/libcore/iter/traits/collect.rs +++ b/src/libcore/iter/traits/collect.rs @@ -91,9 +91,9 @@ /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[rustc_on_unimplemented( - message="a collection of type `{Self}` cannot be built from an iterator \ + message="a value of type `{Self}` cannot be built from an iterator \ over elements of type `{A}`", - label="a collection of type `{Self}` cannot be built from `std::iter::Iterator`", + label="value of type `{Self}` cannot be built from `std::iter::Iterator`", )] pub trait FromIterator: Sized { /// 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 5748c9bcff8cb..5380fae5417e4 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; struct Foo>(T, U); struct WellFormed>(Z); -//~^ ERROR a collection of type `i32` cannot be built from an iterator over elements of type `i32` +//~^ ERROR a value of type `i32` cannot be built from an iterator over elements of type `i32` struct WellFormedNoBounds>(Z); -//~^ ERROR a collection of type `i32` cannot be built from an iterator over elements of type `i32` +//~^ ERROR a value of type `i32` cannot be built from an iterator over elements of type `i32` struct Bounds(T); //~^ 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 6802bc38b89c9..6f84b37d61249 100644 --- a/src/test/ui/type/type-check-defaults.stderr +++ b/src/test/ui/type/type-check-defaults.stderr @@ -1,21 +1,21 @@ -error[E0277]: a collection of type `i32` cannot be built from an iterator over elements of type `i32` +error[E0277]: a value of type `i32` cannot be built from an iterator over elements of type `i32` --> $DIR/type-check-defaults.rs:6:19 | LL | struct Foo>(T, U); | ---------------------------------------- required by `Foo` LL | struct WellFormed>(Z); - | ^ a collection of type `i32` cannot be built from `std::iter::Iterator` + | ^ value of type `i32` cannot be built from `std::iter::Iterator` | = help: the trait `std::iter::FromIterator` is not implemented for `i32` -error[E0277]: a collection of type `i32` cannot be built from an iterator over elements of type `i32` +error[E0277]: a value of type `i32` cannot be built from an iterator over elements of type `i32` --> $DIR/type-check-defaults.rs:8:27 | LL | struct Foo>(T, U); | ---------------------------------------- required by `Foo` ... LL | struct WellFormedNoBounds>(Z); - | ^ a collection of type `i32` cannot be built from `std::iter::Iterator` + | ^ value of type `i32` cannot be built from `std::iter::Iterator` | = help: the trait `std::iter::FromIterator` is not implemented for `i32` 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 5ad50ffcbc389..a25e3ba5fa89f 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() { const l: usize = v.count(); //~ ERROR attempt to use a non-constant value in a constant let s: [u32; l] = v.into_iter().collect(); //~^ ERROR evaluation of constant value failed - //~^^ ERROR a collection of type + //~^^ ERROR a value of type } 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 851004d105897..18a69c50ebd6d 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 LL | let s: [u32; l] = v.into_iter().collect(); | ^ referenced constant has errors -error[E0277]: a collection of type `[u32; _]` cannot be built from an iterator over elements of type `{integer}` +error[E0277]: a value of type `[u32; _]` cannot be built from an iterator over elements of type `{integer}` --> $DIR/type-dependent-def-issue-49241.rs:4:37 | LL | let s: [u32; l] = v.into_iter().collect(); - | ^^^^^^^ a collection of type `[u32; _]` cannot be built from `std::iter::Iterator` + | ^^^^^^^ value of type `[u32; _]` cannot be built from `std::iter::Iterator` | = help: the trait `std::iter::FromIterator<{integer}>` is not implemented for `[u32; _]`