forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#133430 - compiler-errors:param-mismatch, r=…
…WaffleLapkin Tweak parameter mismatch explanation to not say `{unknown}` * Tweak parameter mismatch explanation not to call parameters with no identifier `{unknown}` * Say "both" when there are two parameters * Backtick a type parameter name for consistency
- Loading branch information
Showing
7 changed files
with
75 additions
and
37 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
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 parameter #1 | ||
| | | | ||
| | parameter #2 needs to match the `[X; 1]` type of this parameter | ||
| parameter #1 and parameter #2 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