Skip to content

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

Closed
@nikomatsakis

Description

@nikomatsakis

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');
  |     ^^^^^^^^^^^^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions