-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test with multiple type params failing inference
- Loading branch information
Showing
3 changed files
with
46 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,41 @@ | ||
error[E0283]: type annotations needed for `Bar<i32, &str, Z>` | ||
error[E0283]: type annotations needed for `Foo<i32, &str, W, Z>` | ||
--> $DIR/erase-type-params-in-label.rs:2:15 | ||
| | ||
LL | let foo = new(1, ""); | ||
| --- ^^^ cannot infer type for type parameter `Z` declared on the function `new` | ||
LL | let foo = foo(1, ""); | ||
| --- ^^^ cannot infer type for type parameter `W` declared on the function `foo` | ||
| | | ||
| consider giving `foo` the explicit type `Foo<_, _, W, Z>`, where the type parameter `W` is specified | ||
| | ||
= note: cannot satisfy `_: Default` | ||
note: required by a bound in `foo` | ||
--> $DIR/erase-type-params-in-label.rs:25:17 | ||
| | ||
LL | fn foo<T, K, W: Default, Z: Default>(t: T, k: K) -> Foo<T, K, W, Z> { | ||
| ^^^^^^^ required by this bound in `foo` | ||
help: consider specifying the type arguments in the function call | ||
| | ||
LL | let foo = foo::<T, K, W, Z>(1, ""); | ||
| ++++++++++++++ | ||
|
||
error[E0283]: type annotations needed for `Bar<i32, &str, Z>` | ||
--> $DIR/erase-type-params-in-label.rs:5:15 | ||
| | ||
LL | let bar = bar(1, ""); | ||
| --- ^^^ cannot infer type for type parameter `Z` declared on the function `bar` | ||
| | | ||
| consider giving `foo` the explicit type `Bar<_, _, Z>`, where the type parameter `Z` is specified | ||
| consider giving `bar` the explicit type `Bar<_, _, Z>`, where the type parameter `Z` is specified | ||
| | ||
= note: cannot satisfy `_: Default` | ||
note: required by a bound in `new` | ||
--> $DIR/erase-type-params-in-label.rs:11:17 | ||
note: required by a bound in `bar` | ||
--> $DIR/erase-type-params-in-label.rs:14:17 | ||
| | ||
LL | fn new<T, K, Z: Default>(t: T, k: K) -> Bar<T, K, Z> { | ||
| ^^^^^^^ required by this bound in `new` | ||
LL | fn bar<T, K, Z: Default>(t: T, k: K) -> Bar<T, K, Z> { | ||
| ^^^^^^^ required by this bound in `bar` | ||
help: consider specifying the type arguments in the function call | ||
| | ||
LL | let foo = new::<T, K, Z>(1, ""); | ||
LL | let bar = bar::<T, K, Z>(1, ""); | ||
| +++++++++++ | ||
|
||
error: aborting due to previous error | ||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0283`. |