forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
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#100155 - compiler-errors:issue-100154, r=ja…
…ckh726 Use `node_type_opt` to skip over generics that were not expected Fixes rust-lang#100154
- Loading branch information
Showing
4 changed files
with
51 additions
and
9 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,7 @@ | ||
fn foo(i: impl std::fmt::Display) {} | ||
|
||
fn main() { | ||
foo::<()>(()); | ||
//~^ ERROR this function takes 0 generic arguments but 1 generic argument was supplied | ||
//~| ERROR `()` doesn't implement `std::fmt::Display` | ||
} |
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,35 @@ | ||
error[E0107]: this function takes 0 generic arguments but 1 generic argument was supplied | ||
--> $DIR/issue-100154.rs:4:5 | ||
| | ||
LL | foo::<()>(()); | ||
| ^^^------ help: remove these generics | ||
| | | ||
| expected 0 generic arguments | ||
| | ||
note: function defined here, with 0 generic parameters | ||
--> $DIR/issue-100154.rs:1:4 | ||
| | ||
LL | fn foo(i: impl std::fmt::Display) {} | ||
| ^^^ | ||
= note: `impl Trait` cannot be explicitly specified as a generic argument | ||
|
||
error[E0277]: `()` doesn't implement `std::fmt::Display` | ||
--> $DIR/issue-100154.rs:4:15 | ||
| | ||
LL | foo::<()>(()); | ||
| --------- ^^ `()` cannot be formatted with the default formatter | ||
| | | ||
| required by a bound introduced by this call | ||
| | ||
= help: the trait `std::fmt::Display` is not implemented for `()` | ||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead | ||
note: required by a bound in `foo` | ||
--> $DIR/issue-100154.rs:1:16 | ||
| | ||
LL | fn foo(i: impl std::fmt::Display) {} | ||
| ^^^^^^^^^^^^^^^^^ required by this bound in `foo` | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
Some errors have detailed explanations: E0107, E0277. | ||
For more information about an error, try `rustc --explain E0107`. |
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