summaryrefslogtreecommitdiffstats
path: root/src/test/ui/iterators
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/iterators')
-rw-r--r--src/test/ui/iterators/collect-into-array.rs1
-rw-r--r--src/test/ui/iterators/collect-into-array.stderr6
-rw-r--r--src/test/ui/iterators/collect-into-slice.rs5
-rw-r--r--src/test/ui/iterators/collect-into-slice.stderr23
-rw-r--r--src/test/ui/iterators/integral.stderr24
-rw-r--r--src/test/ui/iterators/issue-28098.rs4
-rw-r--r--src/test/ui/iterators/issue-28098.stderr50
-rw-r--r--src/test/ui/iterators/issue-58952-filter-type-length.rs2
-rw-r--r--src/test/ui/iterators/ranges.stderr4
-rw-r--r--src/test/ui/iterators/string.stderr4
10 files changed, 91 insertions, 32 deletions
diff --git a/src/test/ui/iterators/collect-into-array.rs b/src/test/ui/iterators/collect-into-array.rs
index a1144c8cb..7d35da825 100644
--- a/src/test/ui/iterators/collect-into-array.rs
+++ b/src/test/ui/iterators/collect-into-array.rs
@@ -4,4 +4,5 @@ fn main() {
//~^ ERROR an array of type `[u32; 10]` cannot be built directly from an iterator
//~| NOTE try collecting into a `Vec<{integer}>`, then using `.try_into()`
//~| NOTE required by a bound in `collect`
+ //~| NOTE required by a bound introduced by this call
}
diff --git a/src/test/ui/iterators/collect-into-array.stderr b/src/test/ui/iterators/collect-into-array.stderr
index 7be53a487..7fe9707e6 100644
--- a/src/test/ui/iterators/collect-into-array.stderr
+++ b/src/test/ui/iterators/collect-into-array.stderr
@@ -1,8 +1,10 @@
error[E0277]: an array of type `[u32; 10]` cannot be built directly from an iterator
- --> $DIR/collect-into-array.rs:3:39
+ --> $DIR/collect-into-array.rs:3:31
|
LL | let whatever: [u32; 10] = (0..10).collect();
- | ^^^^^^^ try collecting into a `Vec<{integer}>`, then using `.try_into()`
+ | ^^^^^^^ ------- required by a bound introduced by this call
+ | |
+ | try collecting into a `Vec<{integer}>`, then using `.try_into()`
|
= help: the trait `FromIterator<{integer}>` is not implemented for `[u32; 10]`
note: required by a bound in `collect`
diff --git a/src/test/ui/iterators/collect-into-slice.rs b/src/test/ui/iterators/collect-into-slice.rs
index aafa6bc8b..5eade0756 100644
--- a/src/test/ui/iterators/collect-into-slice.rs
+++ b/src/test/ui/iterators/collect-into-slice.rs
@@ -1,15 +1,20 @@
fn process_slice(data: &[i32]) {
//~^ NOTE required by a bound in this
+ //~| NOTE required by a bound in this
todo!()
}
fn main() {
let some_generated_vec = (0..10).collect();
//~^ ERROR the size for values of type `[i32]` cannot be known at compilation time
+ //~| ERROR the size for values of type `[i32]` cannot be known at compilation time
//~| ERROR a slice of type `[i32]` cannot be built since `[i32]` has no definite size
//~| NOTE try explicitly collecting into a `Vec<{integer}>`
//~| NOTE required by a bound in `collect`
+ //~| NOTE required by a bound in `collect`
//~| NOTE all local variables must have a statically known size
//~| NOTE doesn't have a size known at compile-time
+ //~| NOTE doesn't have a size known at compile-time
+ //~| NOTE required by a bound introduced by this call
process_slice(&some_generated_vec);
}
diff --git a/src/test/ui/iterators/collect-into-slice.stderr b/src/test/ui/iterators/collect-into-slice.stderr
index 4842e65fe..bce40118b 100644
--- a/src/test/ui/iterators/collect-into-slice.stderr
+++ b/src/test/ui/iterators/collect-into-slice.stderr
@@ -1,5 +1,5 @@
error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
- --> $DIR/collect-into-slice.rs:7:9
+ --> $DIR/collect-into-slice.rs:8:9
|
LL | let some_generated_vec = (0..10).collect();
| ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
@@ -8,11 +8,26 @@ LL | let some_generated_vec = (0..10).collect();
= note: all local variables must have a statically known size
= help: unsized locals are gated as an unstable feature
+error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
+ --> $DIR/collect-into-slice.rs:8:38
+ |
+LL | let some_generated_vec = (0..10).collect();
+ | ^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `[i32]`
+note: required by a bound in `collect`
+ --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+ |
+LL | fn collect<B: FromIterator<Self::Item>>(self) -> B
+ | ^ required by this bound in `collect`
+
error[E0277]: a slice of type `[i32]` cannot be built since `[i32]` has no definite size
- --> $DIR/collect-into-slice.rs:7:38
+ --> $DIR/collect-into-slice.rs:8:30
|
LL | let some_generated_vec = (0..10).collect();
- | ^^^^^^^ try explicitly collecting into a `Vec<{integer}>`
+ | ^^^^^^^ ------- required by a bound introduced by this call
+ | |
+ | try explicitly collecting into a `Vec<{integer}>`
|
= help: the trait `FromIterator<{integer}>` is not implemented for `[i32]`
note: required by a bound in `collect`
@@ -21,6 +36,6 @@ note: required by a bound in `collect`
LL | fn collect<B: FromIterator<Self::Item>>(self) -> B
| ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect`
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/iterators/integral.stderr b/src/test/ui/iterators/integral.stderr
index 5e2744bab..047a71f98 100644
--- a/src/test/ui/iterators/integral.stderr
+++ b/src/test/ui/iterators/integral.stderr
@@ -6,7 +6,7 @@ LL | for _ in 42 {}
|
= help: the trait `Iterator` is not implemented for `{integer}`
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
- = note: required because of the requirements on the impl of `IntoIterator` for `{integer}`
+ = note: required for `{integer}` to implement `IntoIterator`
error[E0277]: `u8` is not an iterator
--> $DIR/integral.rs:4:14
@@ -16,7 +16,7 @@ LL | for _ in 42 as u8 {}
|
= help: the trait `Iterator` is not implemented for `u8`
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
- = note: required because of the requirements on the impl of `IntoIterator` for `u8`
+ = note: required for `u8` to implement `IntoIterator`
error[E0277]: `i8` is not an iterator
--> $DIR/integral.rs:6:14
@@ -26,7 +26,7 @@ LL | for _ in 42 as i8 {}
|
= help: the trait `Iterator` is not implemented for `i8`
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
- = note: required because of the requirements on the impl of `IntoIterator` for `i8`
+ = note: required for `i8` to implement `IntoIterator`
error[E0277]: `u16` is not an iterator
--> $DIR/integral.rs:8:14
@@ -36,7 +36,7 @@ LL | for _ in 42 as u16 {}
|
= help: the trait `Iterator` is not implemented for `u16`
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
- = note: required because of the requirements on the impl of `IntoIterator` for `u16`
+ = note: required for `u16` to implement `IntoIterator`
error[E0277]: `i16` is not an iterator
--> $DIR/integral.rs:10:14
@@ -46,7 +46,7 @@ LL | for _ in 42 as i16 {}
|
= help: the trait `Iterator` is not implemented for `i16`
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
- = note: required because of the requirements on the impl of `IntoIterator` for `i16`
+ = note: required for `i16` to implement `IntoIterator`
error[E0277]: `u32` is not an iterator
--> $DIR/integral.rs:12:14
@@ -56,7 +56,7 @@ LL | for _ in 42 as u32 {}
|
= help: the trait `Iterator` is not implemented for `u32`
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
- = note: required because of the requirements on the impl of `IntoIterator` for `u32`
+ = note: required for `u32` to implement `IntoIterator`
error[E0277]: `i32` is not an iterator
--> $DIR/integral.rs:14:14
@@ -66,7 +66,7 @@ LL | for _ in 42 as i32 {}
|
= help: the trait `Iterator` is not implemented for `i32`
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
- = note: required because of the requirements on the impl of `IntoIterator` for `i32`
+ = note: required for `i32` to implement `IntoIterator`
error[E0277]: `u64` is not an iterator
--> $DIR/integral.rs:16:14
@@ -76,7 +76,7 @@ LL | for _ in 42 as u64 {}
|
= help: the trait `Iterator` is not implemented for `u64`
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
- = note: required because of the requirements on the impl of `IntoIterator` for `u64`
+ = note: required for `u64` to implement `IntoIterator`
error[E0277]: `i64` is not an iterator
--> $DIR/integral.rs:18:14
@@ -86,7 +86,7 @@ LL | for _ in 42 as i64 {}
|
= help: the trait `Iterator` is not implemented for `i64`
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
- = note: required because of the requirements on the impl of `IntoIterator` for `i64`
+ = note: required for `i64` to implement `IntoIterator`
error[E0277]: `usize` is not an iterator
--> $DIR/integral.rs:20:14
@@ -96,7 +96,7 @@ LL | for _ in 42 as usize {}
|
= help: the trait `Iterator` is not implemented for `usize`
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
- = note: required because of the requirements on the impl of `IntoIterator` for `usize`
+ = note: required for `usize` to implement `IntoIterator`
error[E0277]: `isize` is not an iterator
--> $DIR/integral.rs:22:14
@@ -106,7 +106,7 @@ LL | for _ in 42 as isize {}
|
= help: the trait `Iterator` is not implemented for `isize`
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
- = note: required because of the requirements on the impl of `IntoIterator` for `isize`
+ = note: required for `isize` to implement `IntoIterator`
error[E0277]: `{float}` is not an iterator
--> $DIR/integral.rs:24:14
@@ -115,7 +115,7 @@ LL | for _ in 42.0 {}
| ^^^^ `{float}` is not an iterator
|
= help: the trait `Iterator` is not implemented for `{float}`
- = note: required because of the requirements on the impl of `IntoIterator` for `{float}`
+ = note: required for `{float}` to implement `IntoIterator`
error: aborting due to 12 previous errors
diff --git a/src/test/ui/iterators/issue-28098.rs b/src/test/ui/iterators/issue-28098.rs
index 62a90d90d..80c77edae 100644
--- a/src/test/ui/iterators/issue-28098.rs
+++ b/src/test/ui/iterators/issue-28098.rs
@@ -2,12 +2,14 @@ fn main() {
let _ = Iterator::next(&mut ());
//~^ ERROR `()` is not an iterator
//~| ERROR `()` is not an iterator
+ //~| ERROR `()` is not an iterator
for _ in false {}
//~^ ERROR `bool` is not an iterator
let _ = Iterator::next(&mut ());
//~^ ERROR `()` is not an iterator
+ //~| ERROR `()` is not an iterator
other()
}
@@ -18,9 +20,11 @@ pub fn other() {
let _ = Iterator::next(&mut ());
//~^ ERROR `()` is not an iterator
//~| ERROR `()` is not an iterator
+ //~| ERROR `()` is not an iterator
let _ = Iterator::next(&mut ());
//~^ ERROR `()` is not an iterator
+ //~| ERROR `()` is not an iterator
for _ in false {}
//~^ ERROR `bool` is not an iterator
diff --git a/src/test/ui/iterators/issue-28098.stderr b/src/test/ui/iterators/issue-28098.stderr
index 3beb99292..3256e57d4 100644
--- a/src/test/ui/iterators/issue-28098.stderr
+++ b/src/test/ui/iterators/issue-28098.stderr
@@ -8,17 +8,25 @@ LL | let _ = Iterator::next(&mut ());
|
= help: the trait `Iterator` is not implemented for `()`
+error[E0277]: `()` is not an iterator
+ --> $DIR/issue-28098.rs:2:13
+ |
+LL | let _ = Iterator::next(&mut ());
+ | ^^^^^^^^^^^^^^^^^^^^^^^ `()` is not an iterator
+ |
+ = help: the trait `Iterator` is not implemented for `()`
+
error[E0277]: `bool` is not an iterator
- --> $DIR/issue-28098.rs:6:14
+ --> $DIR/issue-28098.rs:7:14
|
LL | for _ in false {}
| ^^^^^ `bool` is not an iterator
|
= help: the trait `Iterator` is not implemented for `bool`
- = note: required because of the requirements on the impl of `IntoIterator` for `bool`
+ = note: required for `bool` to implement `IntoIterator`
error[E0277]: `()` is not an iterator
- --> $DIR/issue-28098.rs:9:28
+ --> $DIR/issue-28098.rs:10:28
|
LL | let _ = Iterator::next(&mut ());
| -------------- ^^^^^^^ `()` is not an iterator
@@ -28,6 +36,14 @@ LL | let _ = Iterator::next(&mut ());
= help: the trait `Iterator` is not implemented for `()`
error[E0277]: `()` is not an iterator
+ --> $DIR/issue-28098.rs:10:13
+ |
+LL | let _ = Iterator::next(&mut ());
+ | ^^^^^^^^^^^^^^^^^^^^^^^ `()` is not an iterator
+ |
+ = help: the trait `Iterator` is not implemented for `()`
+
+error[E0277]: `()` is not an iterator
--> $DIR/issue-28098.rs:2:13
|
LL | let _ = Iterator::next(&mut ());
@@ -36,7 +52,7 @@ LL | let _ = Iterator::next(&mut ());
= help: the trait `Iterator` is not implemented for `()`
error[E0277]: `()` is not an iterator
- --> $DIR/issue-28098.rs:18:28
+ --> $DIR/issue-28098.rs:20:28
|
LL | let _ = Iterator::next(&mut ());
| -------------- ^^^^^^^ `()` is not an iterator
@@ -46,7 +62,15 @@ LL | let _ = Iterator::next(&mut ());
= help: the trait `Iterator` is not implemented for `()`
error[E0277]: `()` is not an iterator
- --> $DIR/issue-28098.rs:22:28
+ --> $DIR/issue-28098.rs:20:13
+ |
+LL | let _ = Iterator::next(&mut ());
+ | ^^^^^^^^^^^^^^^^^^^^^^^ `()` is not an iterator
+ |
+ = help: the trait `Iterator` is not implemented for `()`
+
+error[E0277]: `()` is not an iterator
+ --> $DIR/issue-28098.rs:25:28
|
LL | let _ = Iterator::next(&mut ());
| -------------- ^^^^^^^ `()` is not an iterator
@@ -55,23 +79,31 @@ LL | let _ = Iterator::next(&mut ());
|
= help: the trait `Iterator` is not implemented for `()`
+error[E0277]: `()` is not an iterator
+ --> $DIR/issue-28098.rs:25:13
+ |
+LL | let _ = Iterator::next(&mut ());
+ | ^^^^^^^^^^^^^^^^^^^^^^^ `()` is not an iterator
+ |
+ = help: the trait `Iterator` is not implemented for `()`
+
error[E0277]: `bool` is not an iterator
- --> $DIR/issue-28098.rs:25:14
+ --> $DIR/issue-28098.rs:29:14
|
LL | for _ in false {}
| ^^^^^ `bool` is not an iterator
|
= help: the trait `Iterator` is not implemented for `bool`
- = note: required because of the requirements on the impl of `IntoIterator` for `bool`
+ = note: required for `bool` to implement `IntoIterator`
error[E0277]: `()` is not an iterator
- --> $DIR/issue-28098.rs:18:13
+ --> $DIR/issue-28098.rs:20:13
|
LL | let _ = Iterator::next(&mut ());
| ^^^^^^^^^^^^^^ `()` is not an iterator
|
= help: the trait `Iterator` is not implemented for `()`
-error: aborting due to 8 previous errors
+error: aborting due to 12 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/iterators/issue-58952-filter-type-length.rs b/src/test/ui/iterators/issue-58952-filter-type-length.rs
index ffbe89a14..6d12db8d1 100644
--- a/src/test/ui/iterators/issue-58952-filter-type-length.rs
+++ b/src/test/ui/iterators/issue-58952-filter-type-length.rs
@@ -1,6 +1,6 @@
// run-pass
//! This snippet causes the type length to blowup exponentially,
-//! so check that we don't accidentially exceed the type length limit.
+//! so check that we don't accidentally exceed the type length limit.
// FIXME: Once the size of iterator adaptors is further reduced,
// increase the complexity of this test.
use std::collections::VecDeque;
diff --git a/src/test/ui/iterators/ranges.stderr b/src/test/ui/iterators/ranges.stderr
index 440a8960a..b9fbcd530 100644
--- a/src/test/ui/iterators/ranges.stderr
+++ b/src/test/ui/iterators/ranges.stderr
@@ -6,7 +6,7 @@ LL | for _ in ..10 {}
|
= help: the trait `Iterator` is not implemented for `RangeTo<{integer}>`
= note: `..end` is a `RangeTo`, which cannot be iterated on; you might have meant to have a bounded `Range`: `0..end`
- = note: required because of the requirements on the impl of `IntoIterator` for `RangeTo<{integer}>`
+ = note: required for `RangeTo<{integer}>` to implement `IntoIterator`
error[E0277]: `RangeToInclusive<{integer}>` is not an iterator
--> $DIR/ranges.rs:4:14
@@ -16,7 +16,7 @@ LL | for _ in ..=10 {}
|
= help: the trait `Iterator` is not implemented for `RangeToInclusive<{integer}>`
= note: `..=end` is a `RangeToInclusive`, which cannot be iterated on; you might have meant to have a bounded `RangeInclusive`: `0..=end`
- = note: required because of the requirements on the impl of `IntoIterator` for `RangeToInclusive<{integer}>`
+ = note: required for `RangeToInclusive<{integer}>` to implement `IntoIterator`
error: aborting due to 2 previous errors
diff --git a/src/test/ui/iterators/string.stderr b/src/test/ui/iterators/string.stderr
index d9c40fe1b..ddfe0169b 100644
--- a/src/test/ui/iterators/string.stderr
+++ b/src/test/ui/iterators/string.stderr
@@ -5,7 +5,7 @@ LL | for _ in "".to_owned() {}
| ^^^^^^^^^^^^^ `String` is not an iterator; try calling `.chars()` or `.bytes()`
|
= help: the trait `Iterator` is not implemented for `String`
- = note: required because of the requirements on the impl of `IntoIterator` for `String`
+ = note: required for `String` to implement `IntoIterator`
error[E0277]: `&str` is not an iterator
--> $DIR/string.rs:4:14
@@ -14,7 +14,7 @@ LL | for _ in "" {}
| ^^ `&str` is not an iterator; try calling `.chars()` or `.bytes()`
|
= help: the trait `Iterator` is not implemented for `&str`
- = note: required because of the requirements on the impl of `IntoIterator` for `&str`
+ = note: required for `&str` to implement `IntoIterator`
error: aborting due to 2 previous errors