about summary refs log tree commit diff
path: root/tests/ui/iterators
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-10-24 21:14:17 +0000
committerEsteban Küber <esteban@kuber.com.ar>2024-10-29 16:26:57 +0000
commit5b542866400ad4a294f468cfa7e059d95c27a079 (patch)
tree9b6d681e3e95f2b45b2d9ceb0996d4344ce1b3d3 /tests/ui/iterators
parent2dece5bb62f234f5622a08289c5a3d1555cd7843 (diff)
downloadrust-5b542866400ad4a294f468cfa7e059d95c27a079.tar.gz
rust-5b542866400ad4a294f468cfa7e059d95c27a079.zip
Remove detail from label/note that is already available in other note
Remove the "which is required by `{root_obligation}`" post-script in
"the trait `X` is not implemented for `Y`" explanation in E0277. This
information is already conveyed in the notes explaining requirements,
making it redundant while making the text (particularly in labels)
harder to read.

```
error[E0277]: the trait bound `NotCopy: Copy` is not satisfied
  --> $DIR/wf-static-type.rs:10:13
   |
LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None };
   |             ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy`
   |
   = note: required for `Option<NotCopy>` to implement `Copy`
note: required by a bound in `IsCopy`
  --> $DIR/wf-static-type.rs:7:17
   |
LL | struct IsCopy<T:Copy> { t: T }
   |                 ^^^^ required by this bound in `IsCopy`
```
vs the prior

```
error[E0277]: the trait bound `NotCopy: Copy` is not satisfied
  --> $DIR/wf-static-type.rs:10:13
   |
LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None };
   |             ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy`, which is required by `Option<NotCopy>: Copy`
   |
   = note: required for `Option<NotCopy>` to implement `Copy`
note: required by a bound in `IsCopy`
  --> $DIR/wf-static-type.rs:7:17
   |
LL | struct IsCopy<T:Copy> { t: T }
   |                 ^^^^ required by this bound in `IsCopy`
```
Diffstat (limited to 'tests/ui/iterators')
-rw-r--r--tests/ui/iterators/float_iterator_hint.stderr2
-rw-r--r--tests/ui/iterators/integral.stderr24
-rw-r--r--tests/ui/iterators/issue-28098.stderr4
-rw-r--r--tests/ui/iterators/ranges.stderr4
-rw-r--r--tests/ui/iterators/string.stderr4
5 files changed, 19 insertions, 19 deletions
diff --git a/tests/ui/iterators/float_iterator_hint.stderr b/tests/ui/iterators/float_iterator_hint.stderr
index 29319b9400f..c3cb00c3c68 100644
--- a/tests/ui/iterators/float_iterator_hint.stderr
+++ b/tests/ui/iterators/float_iterator_hint.stderr
@@ -4,7 +4,7 @@ error[E0277]: `{float}` is not an iterator
 LL |     for i in 0.2 {
    |              ^^^ `{float}` is not an iterator
    |
-   = help: the trait `Iterator` is not implemented for `{float}`, which is required by `{float}: IntoIterator`
+   = help: the trait `Iterator` is not implemented for `{float}`
    = 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 for `{float}` to implement `IntoIterator`
 
diff --git a/tests/ui/iterators/integral.stderr b/tests/ui/iterators/integral.stderr
index 74bbe28d6b7..c142fec8da0 100644
--- a/tests/ui/iterators/integral.stderr
+++ b/tests/ui/iterators/integral.stderr
@@ -4,7 +4,7 @@ error[E0277]: `{integer}` is not an iterator
 LL |     for _ in 42 {}
    |              ^^ `{integer}` is not an iterator
    |
-   = help: the trait `Iterator` is not implemented for `{integer}`, which is required by `{integer}: IntoIterator`
+   = 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 for `{integer}` to implement `IntoIterator`
 
@@ -14,7 +14,7 @@ error[E0277]: `u8` is not an iterator
 LL |     for _ in 42 as u8 {}
    |              ^^^^^^^^ `u8` is not an iterator
    |
-   = help: the trait `Iterator` is not implemented for `u8`, which is required by `u8: IntoIterator`
+   = 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 for `u8` to implement `IntoIterator`
 
@@ -24,7 +24,7 @@ error[E0277]: `i8` is not an iterator
 LL |     for _ in 42 as i8 {}
    |              ^^^^^^^^ `i8` is not an iterator
    |
-   = help: the trait `Iterator` is not implemented for `i8`, which is required by `i8: IntoIterator`
+   = 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 for `i8` to implement `IntoIterator`
 
@@ -34,7 +34,7 @@ error[E0277]: `u16` is not an iterator
 LL |     for _ in 42 as u16 {}
    |              ^^^^^^^^^ `u16` is not an iterator
    |
-   = help: the trait `Iterator` is not implemented for `u16`, which is required by `u16: IntoIterator`
+   = 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 for `u16` to implement `IntoIterator`
 
@@ -44,7 +44,7 @@ error[E0277]: `i16` is not an iterator
 LL |     for _ in 42 as i16 {}
    |              ^^^^^^^^^ `i16` is not an iterator
    |
-   = help: the trait `Iterator` is not implemented for `i16`, which is required by `i16: IntoIterator`
+   = 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 for `i16` to implement `IntoIterator`
 
@@ -54,7 +54,7 @@ error[E0277]: `u32` is not an iterator
 LL |     for _ in 42 as u32 {}
    |              ^^^^^^^^^ `u32` is not an iterator
    |
-   = help: the trait `Iterator` is not implemented for `u32`, which is required by `u32: IntoIterator`
+   = 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 for `u32` to implement `IntoIterator`
 
@@ -64,7 +64,7 @@ error[E0277]: `i32` is not an iterator
 LL |     for _ in 42 as i32 {}
    |              ^^^^^^^^^ `i32` is not an iterator
    |
-   = help: the trait `Iterator` is not implemented for `i32`, which is required by `i32: IntoIterator`
+   = 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 for `i32` to implement `IntoIterator`
 
@@ -74,7 +74,7 @@ error[E0277]: `u64` is not an iterator
 LL |     for _ in 42 as u64 {}
    |              ^^^^^^^^^ `u64` is not an iterator
    |
-   = help: the trait `Iterator` is not implemented for `u64`, which is required by `u64: IntoIterator`
+   = 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 for `u64` to implement `IntoIterator`
 
@@ -84,7 +84,7 @@ error[E0277]: `i64` is not an iterator
 LL |     for _ in 42 as i64 {}
    |              ^^^^^^^^^ `i64` is not an iterator
    |
-   = help: the trait `Iterator` is not implemented for `i64`, which is required by `i64: IntoIterator`
+   = 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 for `i64` to implement `IntoIterator`
 
@@ -94,7 +94,7 @@ error[E0277]: `usize` is not an iterator
 LL |     for _ in 42 as usize {}
    |              ^^^^^^^^^^^ `usize` is not an iterator
    |
-   = help: the trait `Iterator` is not implemented for `usize`, which is required by `usize: IntoIterator`
+   = 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 for `usize` to implement `IntoIterator`
 
@@ -104,7 +104,7 @@ error[E0277]: `isize` is not an iterator
 LL |     for _ in 42 as isize {}
    |              ^^^^^^^^^^^ `isize` is not an iterator
    |
-   = help: the trait `Iterator` is not implemented for `isize`, which is required by `isize: IntoIterator`
+   = 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 for `isize` to implement `IntoIterator`
 
@@ -114,7 +114,7 @@ error[E0277]: `{float}` is not an iterator
 LL |     for _ in 42.0 {}
    |              ^^^^ `{float}` is not an iterator
    |
-   = help: the trait `Iterator` is not implemented for `{float}`, which is required by `{float}: IntoIterator`
+   = help: the trait `Iterator` is not implemented for `{float}`
    = 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 for `{float}` to implement `IntoIterator`
 
diff --git a/tests/ui/iterators/issue-28098.stderr b/tests/ui/iterators/issue-28098.stderr
index 3cb1b2f7270..a724f03ad4a 100644
--- a/tests/ui/iterators/issue-28098.stderr
+++ b/tests/ui/iterators/issue-28098.stderr
@@ -14,7 +14,7 @@ error[E0277]: `bool` is not an iterator
 LL |     for _ in false {}
    |              ^^^^^ `bool` is not an iterator
    |
-   = help: the trait `Iterator` is not implemented for `bool`, which is required by `bool: IntoIterator`
+   = help: the trait `Iterator` is not implemented for `bool`
    = note: required for `bool` to implement `IntoIterator`
 
 error[E0277]: `()` is not an iterator
@@ -61,7 +61,7 @@ error[E0277]: `bool` is not an iterator
 LL |     for _ in false {}
    |              ^^^^^ `bool` is not an iterator
    |
-   = help: the trait `Iterator` is not implemented for `bool`, which is required by `bool: IntoIterator`
+   = help: the trait `Iterator` is not implemented for `bool`
    = note: required for `bool` to implement `IntoIterator`
 
 error[E0277]: `()` is not an iterator
diff --git a/tests/ui/iterators/ranges.stderr b/tests/ui/iterators/ranges.stderr
index a5d43ecbb63..b9fbcd5304b 100644
--- a/tests/ui/iterators/ranges.stderr
+++ b/tests/ui/iterators/ranges.stderr
@@ -4,7 +4,7 @@ error[E0277]: `RangeTo<{integer}>` is not an iterator
 LL |     for _ in ..10 {}
    |              ^^^^ if you meant to iterate until a value, add a starting value
    |
-   = help: the trait `Iterator` is not implemented for `RangeTo<{integer}>`, which is required by `RangeTo<{integer}>: IntoIterator`
+   = 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 for `RangeTo<{integer}>` to implement `IntoIterator`
 
@@ -14,7 +14,7 @@ error[E0277]: `RangeToInclusive<{integer}>` is not an iterator
 LL |     for _ in ..=10 {}
    |              ^^^^^ if you meant to iterate until a value (including it), add a starting value
    |
-   = help: the trait `Iterator` is not implemented for `RangeToInclusive<{integer}>`, which is required by `RangeToInclusive<{integer}>: IntoIterator`
+   = 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 for `RangeToInclusive<{integer}>` to implement `IntoIterator`
 
diff --git a/tests/ui/iterators/string.stderr b/tests/ui/iterators/string.stderr
index 29f560677c0..ddfe0169b84 100644
--- a/tests/ui/iterators/string.stderr
+++ b/tests/ui/iterators/string.stderr
@@ -4,7 +4,7 @@ error[E0277]: `String` is not an iterator
 LL |     for _ in "".to_owned() {}
    |              ^^^^^^^^^^^^^ `String` is not an iterator; try calling `.chars()` or `.bytes()`
    |
-   = help: the trait `Iterator` is not implemented for `String`, which is required by `String: IntoIterator`
+   = help: the trait `Iterator` is not implemented for `String`
    = note: required for `String` to implement `IntoIterator`
 
 error[E0277]: `&str` is not an iterator
@@ -13,7 +13,7 @@ error[E0277]: `&str` is not an iterator
 LL |     for _ in "" {}
    |              ^^ `&str` is not an iterator; try calling `.chars()` or `.bytes()`
    |
-   = help: the trait `Iterator` is not implemented for `&str`, which is required by `&str: IntoIterator`
+   = help: the trait `Iterator` is not implemented for `&str`
    = note: required for `&str` to implement `IntoIterator`
 
 error: aborting due to 2 previous errors