-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tweak parameter mismatch explanation to not say unknown
- Loading branch information
1 parent
15b663e
commit 78fa5a1
Showing
8 changed files
with
87 additions
and
38 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
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
fn same_type<T>(_: T, _: T) {} | ||
|
||
fn f<X, Y>(x: X, y: Y) { | ||
same_type([x], Some(y)); | ||
//~^ ERROR mismatched types | ||
} | ||
|
||
fn main() {} |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/param-mismatch-no-names.rs:4:20 | ||
| | ||
LL | same_type([x], Some(y)); | ||
| --------- --- ^^^^^^^ expected `[X; 1]`, found `Option<Y>` | ||
| | | | ||
| | expected all arguments to be this `[X; 1]` type because they need to match the type of this parameter | ||
| arguments to this function are incorrect | ||
| | ||
= note: expected array `[X; 1]` | ||
found enum `Option<Y>` | ||
note: function defined here | ||
--> $DIR/param-mismatch-no-names.rs:1:4 | ||
| | ||
LL | fn same_type<T>(_: T, _: T) {} | ||
| ^^^^^^^^^ - ---- ---- this parameter needs to match the `[X; 1]` type of the 1st parameter | ||
| | | | ||
| | the 2nd parameter needs to match the `[X; 1]` type of this parameter | ||
| the 1st parameter and the 2nd parameter both reference this parameter `T` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
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