diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2019-10-29 16:49:01 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2019-12-10 12:02:18 -0800 |
| commit | 12af2561e9936add8fab4b96ff206b00a5877efe (patch) | |
| tree | b5b5410af50110a0231f489451b3611ab6adf644 /src/test | |
| parent | 7dbfb0a8ca4ab74ee3111e57a024f9e6257ce37c (diff) | |
| download | rust-12af2561e9936add8fab4b96ff206b00a5877efe.tar.gz rust-12af2561e9936add8fab4b96ff206b00a5877efe.zip | |
Point at method call when type annotations are needed
Diffstat (limited to 'src/test')
9 files changed, 41 insertions, 22 deletions
diff --git a/src/test/ui/associated-types/associated-types-overridden-binding.stderr b/src/test/ui/associated-types/associated-types-overridden-binding.stderr index 5ef1b23cbcd..dd6bde0c14d 100644 --- a/src/test/ui/associated-types/associated-types-overridden-binding.stderr +++ b/src/test/ui/associated-types/associated-types-overridden-binding.stderr @@ -1,18 +1,23 @@ -error[E0284]: type annotations needed: cannot resolve `<Self as std::iter::Iterator>::Item == i32` +error[E0284]: type annotations needed --> $DIR/associated-types-overridden-binding.rs:4:1 | LL | trait Foo: Iterator<Item = i32> {} | ------------------------------- required by `Foo` LL | trait Bar: Foo<Item = u32> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for `Self` + | + = note: cannot resolve `<Self as std::iter::Iterator>::Item == i32` -error[E0282]: type annotations needed +error[E0284]: type annotations needed --> $DIR/associated-types-overridden-binding.rs:7:1 | +LL | trait I32Iterator = Iterator<Item = i32>; + | ----------------------------------------- required by `I32Iterator` LL | trait U32Iterator = I32Iterator<Item = u32>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for `Self` + | + = note: cannot resolve `<Self as std::iter::Iterator>::Item == i32` error: aborting due to 2 previous errors -Some errors have detailed explanations: E0282, E0284. -For more information about an error, try `rustc --explain E0282`. +For more information about this error, try `rustc --explain E0284`. diff --git a/src/test/ui/associated-types/associated-types-unconstrained.stderr b/src/test/ui/associated-types/associated-types-unconstrained.stderr index 4e9e54d3688..14ce4836f97 100644 --- a/src/test/ui/associated-types/associated-types-unconstrained.stderr +++ b/src/test/ui/associated-types/associated-types-unconstrained.stderr @@ -1,8 +1,10 @@ -error[E0284]: type annotations needed: cannot resolve `<_ as Foo>::A == _` +error[E0284]: type annotations needed --> $DIR/associated-types-unconstrained.rs:14:20 | LL | let x: isize = Foo::bar(); - | ^^^^^^^^ + | ^^^^^^^^ cannot infer type + | + = note: cannot resolve `<_ as Foo>::A == _` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-12028.stderr b/src/test/ui/issues/issue-12028.stderr index ff92d01a69e..5f23b4f559f 100644 --- a/src/test/ui/issues/issue-12028.stderr +++ b/src/test/ui/issues/issue-12028.stderr @@ -1,8 +1,10 @@ -error[E0284]: type annotations needed: cannot resolve `<_ as StreamHasher>::S == <H as StreamHasher>::S` +error[E0284]: type annotations needed --> $DIR/issue-12028.rs:27:14 | LL | self.input_stream(&mut stream); - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^ cannot infer type for `H` + | + = note: cannot resolve `<_ as StreamHasher>::S == <H as StreamHasher>::S` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-65611.stderr b/src/test/ui/issues/issue-65611.stderr index cb441c13c6b..905c5ae9461 100644 --- a/src/test/ui/issues/issue-65611.stderr +++ b/src/test/ui/issues/issue-65611.stderr @@ -2,7 +2,10 @@ error[E0282]: type annotations needed --> $DIR/issue-65611.rs:59:20 | LL | let x = buffer.last().unwrap().0.clone(); - | ^^^^ cannot infer type for `T` + | ^^^^ + | | + | cannot infer type for `T` + | help: consider specifying the type argument in the method call: `last::<_>` | = note: type must be known at this point diff --git a/src/test/ui/question-mark-type-infer.rs b/src/test/ui/question-mark-type-infer.rs index 95ee01a70ce..2ef8618192f 100644 --- a/src/test/ui/question-mark-type-infer.rs +++ b/src/test/ui/question-mark-type-infer.rs @@ -9,7 +9,7 @@ fn f(x: &i32) -> Result<i32, ()> { fn g() -> Result<Vec<i32>, ()> { let l = [1, 2, 3, 4]; - l.iter().map(f).collect()? //~ ERROR type annotations needed: cannot resolve + l.iter().map(f).collect()? //~ ERROR type annotations needed } fn main() { diff --git a/src/test/ui/question-mark-type-infer.stderr b/src/test/ui/question-mark-type-infer.stderr index 53a170e7d43..d32d9497645 100644 --- a/src/test/ui/question-mark-type-infer.stderr +++ b/src/test/ui/question-mark-type-infer.stderr @@ -1,8 +1,13 @@ -error[E0284]: type annotations needed: cannot resolve `<_ as std::ops::Try>::Ok == _` - --> $DIR/question-mark-type-infer.rs:12:5 +error[E0284]: type annotations needed + --> $DIR/question-mark-type-infer.rs:12:21 | LL | l.iter().map(f).collect()? - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^ + | | + | cannot infer type + | help: consider specifying the type argument in the method call: `collect::<_>` + | + = note: cannot resolve `<_ as std::ops::Try>::Ok == _` error: aborting due to previous error diff --git a/src/test/ui/span/issue-42234-unknown-receiver-type.rs b/src/test/ui/span/issue-42234-unknown-receiver-type.rs index 58138e21bc0..d3292bbecba 100644 --- a/src/test/ui/span/issue-42234-unknown-receiver-type.rs +++ b/src/test/ui/span/issue-42234-unknown-receiver-type.rs @@ -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() } diff --git a/src/test/ui/span/issue-42234-unknown-receiver-type.stderr b/src/test/ui/span/issue-42234-unknown-receiver-type.stderr index 30c9adb1dce..093a6f6f3eb 100644 --- a/src/test/ui/span/issue-42234-unknown-receiver-type.stderr +++ b/src/test/ui/span/issue-42234-unknown-receiver-type.stderr @@ -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 diff --git a/src/test/ui/span/type-annotations-needed-expr.stderr b/src/test/ui/span/type-annotations-needed-expr.stderr index e32a542bb7a..1efb2720e0c 100644 --- a/src/test/ui/span/type-annotations-needed-expr.stderr +++ b/src/test/ui/span/type-annotations-needed-expr.stderr @@ -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 |
