Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error message when passing parameters to fn using impl Trait is ungreat #48703

Closed
nikomatsakis opened this issue Mar 3, 2018 · 0 comments · Fixed by #48709
Closed

error message when passing parameters to fn using impl Trait is ungreat #48703

nikomatsakis opened this issue Mar 3, 2018 · 0 comments · Fixed by #48709
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@nikomatsakis
Copy link
Contributor

This program:

#![feature(universal_impl_trait)]

use std::fmt::Debug;

fn foo<T>(x: impl Debug) { }

fn main() {
    foo::<String>('a');
}

gives the error:

error[E0089]: too few type parameters provided: expected 2 type parameters, found 1 type parameter
 --> src/main.rs:8:5
  |
8 |     foo::<String>('a');
  |     ^^^^^^^^^^^^^ expected 2 type parameters

error[E0632]: cannot provide explicit type parameters when `impl Trait` is used in argument position.
 --> src/main.rs:8:5
  |
8 |     foo::<String>('a');
  |     ^^^^^^^^^^^^^

I would expect just:

error[E0632]: cannot provide explicit type parameters when `impl Trait` is used in argument position.
 --> src/main.rs:8:5
  |
8 |     foo::<String>('a');
  |     ^^^^^^^^^^^^^
@nikomatsakis nikomatsakis added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 3, 2018
alexcrichton added a commit to alexcrichton/rust that referenced this issue Apr 5, 2018
remove erroneous error message when checking impl trait params

fixes rust-lang#48703
bors added a commit that referenced this issue Apr 5, 2018
remove erroneous error message when checking impl trait params

fixes #48703
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant