diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-12-13 01:17:09 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-13 01:17:09 +0100 |
| commit | 8917cc0f23f97e42e652f9130b7daa6a48193cef (patch) | |
| tree | a1e2eb311bc21a165bb3612b180035dda68fde22 /src/test/ui/traits | |
| parent | 6dbaf86672397081f4b946b18acc37d1a27611d8 (diff) | |
| parent | f4ed2d1cca0106eb4aec99b61670ecac378ca087 (diff) | |
| download | rust-8917cc0f23f97e42e652f9130b7daa6a48193cef.tar.gz rust-8917cc0f23f97e42e652f9130b7daa6a48193cef.zip | |
Rollup merge of #105332 - estebank:iterator-chains, r=oli-obk
Point out the type of associated types in every method call of iterator chains
Partially address #105184 by pointing out the type of associated types in every method call of iterator chains:
```
note: the expression is of type `Map<std::slice::Iter<'_, {integer}>, [closure@src/test/ui/iterators/invalid-iterator-chain.rs:12:18: 12:21]>`
--> src/test/ui/iterators/invalid-iterator-chain.rs:12:14
|
10 | vec![0, 1]
| ---------- this expression has type `Vec<{integer}>`
11 | .iter()
| ------ associated type `std::iter::Iterator::Item` is `&{integer}` here
12 | .map(|x| { x; })
| ^^^^^^^^^^^^^^^ associated type `std::iter::Iterator::Item` is `()` here
```
We also reduce the number of impls we mention when any of the candidates is an "exact match". This benefits the output of cases with numerics greatly.
Outstanding work would be to provide a structured suggestion for appropriate changes, like in this case detecting the spurious `;` in the closure.
Diffstat (limited to 'src/test/ui/traits')
| -rw-r--r-- | src/test/ui/traits/issue-97576.stderr | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/test/ui/traits/issue-97576.stderr b/src/test/ui/traits/issue-97576.stderr index 146d38d076a..9062a0fab63 100644 --- a/src/test/ui/traits/issue-97576.stderr +++ b/src/test/ui/traits/issue-97576.stderr @@ -1,10 +1,8 @@ error[E0277]: the trait bound `String: From<impl ToString>` is not satisfied - --> $DIR/issue-97576.rs:8:18 + --> $DIR/issue-97576.rs:8:22 | LL | bar: bar.into(), - | ^^^ ---- required by a bound introduced by this call - | | - | the trait `From<impl ToString>` is not implemented for `String` + | ^^^^ the trait `From<impl ToString>` is not implemented for `String` | = note: required for `impl ToString` to implement `Into<String>` |
