7

Point out the type of associated types in every method call of iterator chains b...

 1 year ago
source link: https://github.com/rust-lang/rust/pull/105332
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Contributor

@estebank estebank commented Dec 5, 2022

edited

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.

Techie-Pi, Be-ing, alarsyo, aliemjay, SetKu, and dgiger42 reacted with hooray emoji

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK