Skip to content

Operator overloading only considers the method name, not which trait is implemented #12402

Closed
@SiegeLord

Description

@SiegeLord

Currently this code compiles, but it shouldn't:

trait MyMul<RHS, Res>
{
    fn mul(&self, rhs: &RHS) -> Res;
}

fn foo<T: MyMul<f64, f64>>(a: &T, b: f64) -> f64
{
    a * b
}

fn main()
{

}

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