Indicate origin of where type parameter for uninferred types

This commit is contained in:
Ohad Ravid 2019-12-13 19:54:18 +01:00
parent 12307b3b08
commit 8a4632dec6
28 changed files with 97 additions and 41 deletions

View file

@ -2,7 +2,7 @@ error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:9:5
|
LL | bar().await;
| ^^^ cannot infer type for type parameter `T`
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
--> $DIR/unresolved_type_param.rs:9:5

View file

@ -30,7 +30,7 @@ error[E0282]: type annotations needed
--> $DIR/fn-const-param-infer.rs:22:23
|
LL | let _ = Checked::<generic>;
| ^^^^^^^ cannot infer type for type parameter `T`
| ^^^^^^^ cannot infer type for type parameter `T` declared on the function `generic`
error[E0308]: mismatched types
--> $DIR/fn-const-param-infer.rs:25:40

View file

@ -2,13 +2,13 @@ error[E0282]: type annotations needed
--> $DIR/issue-64662.rs:2:9
|
LL | A = foo(),
| ^^^ cannot infer type for type parameter `T`
| ^^^ cannot infer type for type parameter `T` declared on the function `foo`
error[E0282]: type annotations needed
--> $DIR/issue-64662.rs:3:9
|
LL | B = foo(),
| ^^^ cannot infer type for type parameter `T`
| ^^^ cannot infer type for type parameter `T` declared on the function `foo`
error: aborting due to 2 previous errors

View file

@ -36,7 +36,7 @@ error[E0282]: type annotations needed
--> $DIR/E0401.rs:11:5
|
LL | bfnr(x);
| ^^^^ cannot infer type for type parameter `U`
| ^^^^ cannot infer type for type parameter `U` declared on the function `bfnr`
error: aborting due to 4 previous errors

View file

@ -2,7 +2,7 @@ error[E0284]: type annotations needed
--> $DIR/issue-12028.rs:27:14
|
LL | self.input_stream(&mut stream);
| ^^^^^^^^^^^^ cannot infer type for type parameter `H`
| ^^^^^^^^^^^^ cannot infer type for type parameter `H` declared on the trait `StreamHash`
|
= note: cannot resolve `<_ as StreamHasher>::S == <H as StreamHasher>::S`

View file

@ -2,7 +2,7 @@ error[E0282]: type annotations needed
--> $DIR/issue-16966.rs:2:5
|
LL | panic!(std::default::Default::default());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `M`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `M` declared on the function `begin_panic`
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

View file

@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `B<T>`
--> $DIR/issue-17551.rs:6:15
|
LL | let foo = B(marker::PhantomData);
| --- ^ cannot infer type for type parameter `T`
| --- ^ cannot infer type for type parameter `T` declared on the struct `B`
| |
| consider giving `foo` the explicit type `B<T>`, where the type parameter `T` is specified

View file

@ -5,7 +5,7 @@ LL | let (tx, rx) = channel();
| -------- consider giving this pattern the explicit type `(std::sync::mpsc::Sender<Foo<T>>, std::sync::mpsc::Receiver<Foo<T>>)`, where the type parameter `T` is specified
...
LL | tx.send(Foo{ foo: PhantomData });
| ^^^ cannot infer type for type parameter `T`
| ^^^ cannot infer type for type parameter `T` declared on the struct `Foo`
error: aborting due to previous error

View file

@ -2,7 +2,7 @@ error[E0282]: type annotations needed
--> $DIR/issue-5062.rs:1:29
|
LL | fn main() { format!("{:?}", None); }
| ^^^^ cannot infer type for type parameter `T`
| ^^^^ cannot infer type for type parameter `T` declared on the enum `Option`
error: aborting due to previous error

View file

@ -2,7 +2,7 @@ error[E0282]: type annotations needed
--> $DIR/issue-6458-2.rs:3:21
|
LL | format!("{:?}", None);
| ^^^^ cannot infer type for type parameter `T`
| ^^^^ cannot infer type for type parameter `T` declared on the enum `Option`
error: aborting due to previous error

View file

@ -2,7 +2,7 @@ error[E0282]: type annotations needed
--> $DIR/issue-6458-3.rs:4:5
|
LL | mem::transmute(0);
| ^^^^^^^^^^^^^^ cannot infer type for type parameter `U`
| ^^^^^^^^^^^^^^ cannot infer type for type parameter `U` declared on the function `transmute`
error: aborting due to previous error

View file

@ -2,7 +2,7 @@ error[E0282]: type annotations needed
--> $DIR/issue-6458.rs:9:4
|
LL | foo(TypeWithState(marker::PhantomData));
| ^^^ cannot infer type for type parameter `State`
| ^^^ cannot infer type for type parameter `State` declared on the function `foo`
error: aborting due to previous error

View file

@ -2,7 +2,7 @@ error[E0282]: type annotations needed
--> $DIR/missing-type-parameter.rs:4:5
|
LL | foo();
| ^^^ cannot infer type for type parameter `X`
| ^^^ cannot infer type for type parameter `X` declared on the function `foo`
error: aborting due to previous error

View file

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

View file

@ -2,7 +2,7 @@ error[E0282]: type annotations needed
--> $DIR/traits-multidispatch-convert-ambig-dest.rs:26:5
|
LL | test(22, std::default::Default::default());
| ^^^^ cannot infer type for type parameter `U`
| ^^^^ cannot infer type for type parameter `U` declared on the function `test`
error: aborting due to previous error

View file

@ -4,7 +4,7 @@ error[E0282]: type annotations needed
LL | .or_else(|err| {
| ^^^^^^^
| |
| cannot infer type for type parameter `F`
| cannot infer type for type parameter `F` declared on the method `or_else`
| help: consider specifying the type arguments in the method call: `or_else::<F, O>`
error: aborting due to previous error

View file

@ -4,7 +4,7 @@ error[E0282]: type annotations needed
LL | lst.sort_by_key(|&(v, _)| v.iter().sum());
| ^^^^^^^^^^^ --- help: consider specifying the type argument in the method call: `sum::<S>`
| |
| cannot infer type for type parameter `K`
| cannot infer type for type parameter `K` declared on the method `sort_by_key`
error: aborting due to previous error

View file

@ -8,7 +8,7 @@ LL | S(std::marker::PhantomData).foo();
| ^--------------------------------
| |
| this method call resolves to `<Self as T>::A`
| cannot infer type for type parameter `X`
| cannot infer type for type parameter `X` declared on the struct `S`
error: aborting due to previous error

View file

@ -2,7 +2,7 @@ error[E0282]: type annotations needed
--> $DIR/unbounded-type-param-in-fn-with-assoc-type.rs:8:5
|
LL | foo();
| ^^^ cannot infer type for type parameter `T`
| ^^^ cannot infer type for type parameter `T` declared on the function `foo`
error: aborting due to previous error

View file

@ -2,7 +2,7 @@ error[E0282]: type annotations needed
--> $DIR/unbounded-type-param-in-fn.rs:6:5
|
LL | foo();
| ^^^ cannot infer type for type parameter `T`
| ^^^ cannot infer type for type parameter `T` declared on the function `foo`
error: aborting due to previous error

View file

@ -7,7 +7,7 @@ LL | fn foo<T: Into<String>>(x: i32) {}
LL | foo(42);
| ^^^
| |
| cannot infer type for type parameter `T`
| cannot infer type for type parameter `T` declared on the function `foo`
| help: consider specifying the type argument in the function call: `foo::<T>`
|
= note: cannot resolve `_: std::convert::Into<std::string::String>`

View file

@ -2,7 +2,7 @@ error[E0282]: type annotations needed
--> $DIR/unconstrained-none.rs:4:5
|
LL | None;
| ^^^^ cannot infer type for type parameter `T`
| ^^^^ cannot infer type for type parameter `T` declared on the enum `Option`
error: aborting due to previous error

View file

@ -2,7 +2,7 @@ error[E0282]: type annotations needed
--> $DIR/unconstrained-ref.rs:6:5
|
LL | S { o: &None };
| ^ cannot infer type for type parameter `T`
| ^ cannot infer type for type parameter `T` declared on the struct `S`
error: aborting due to previous error