-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 #85520 - FabianWolff:issue-85475, r=jackh726
Fix typo and improve documentation for E0632 Edit: After #85520 (comment), this PR has been boiled down to just an extended description for `E0632` and a fixed typo.
- Loading branch information
Showing
8 changed files
with
32 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
An explicit generic argument was provided when calling a function that | ||
uses `impl Trait` in argument position. | ||
|
||
Erroneous code example: | ||
|
||
```compile_fail,E0632 | ||
fn foo<T: Copy>(a: T, b: impl Clone) {} | ||
foo::<i32>(0i32, "abc".to_string()); | ||
``` | ||
|
||
Either all generic arguments should be inferred at the call site, or | ||
the function definition should use an explicit generic type parameter | ||
instead of `impl Trait`. Example: | ||
|
||
``` | ||
fn foo<T: Copy>(a: T, b: impl Clone) {} | ||
fn bar<T: Copy, U: Clone>(a: T, b: U) {} | ||
foo(0i32, "abc".to_string()); | ||
bar::<i32, String>(0i32, "abc".to_string()); | ||
bar::<_, _>(0i32, "abc".to_string()); | ||
bar(0i32, "abc".to_string()); | ||
``` |
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