Point at method call when type annotations are needed

This commit is contained in:
Esteban Küber 2019-10-29 16:49:01 -07:00
parent 7dbfb0a8ca
commit 12af2561e9
13 changed files with 108 additions and 44 deletions

View file

@ -9,8 +9,8 @@ fn shines_a_beacon_through_the_darkness() {
}
fn courier_to_des_moines_and_points_west(data: &[u32]) -> String {
data.iter() //~ ERROR type annotations needed
.sum::<_>()
data.iter()
.sum::<_>() //~ ERROR type annotations needed
.to_string()
}

View file

@ -9,11 +9,10 @@ LL | x.unwrap().method_that_could_exist_on_some_type();
= note: type must be known at this point
error[E0282]: type annotations needed
--> $DIR/issue-42234-unknown-receiver-type.rs:12:5
--> $DIR/issue-42234-unknown-receiver-type.rs:13:10
|
LL | / data.iter()
LL | | .sum::<_>()
| |___________________^ cannot infer type
LL | .sum::<_>()
| ^^^ cannot infer type
|
= note: type must be known at this point

View file

@ -2,7 +2,10 @@ error[E0282]: type annotations needed
--> $DIR/type-annotations-needed-expr.rs:2:39
|
LL | let _ = (vec![1,2,3]).into_iter().sum() as f64;
| ^^^ cannot infer type for `S`
| ^^^
| |
| cannot infer type for `S`
| help: consider specifying the type argument in the method call: `sum::<_>`
|
= note: type must be known at this point