Skip to content

Fns with different arguments should be different types #34868

Closed
@jethrogb

Description

@jethrogb

Currently you can't write something like this:

pub trait MyTrait {
}

impl<F> MyTrait for F where F: FnMut() {
}

impl<F> MyTrait for F where F: FnMut(usize) -> usize {
}

This results in an error about conflicting implementations. This is because there might exist a type that implements both FnMut() and FnMut(usize) -> usize. In reality such a type will of course never exist.

Potential dupe of #19032 but I'm not sure

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions