Skip to content

Possible bug with operator overloading on traits/associated types #52025

Closed
@jackmott

Description

@jackmott

See the following playground code:
https://play.rust-lang.org/?gist=bf70f00b6d1998921a4571bd331f6530

If you run it, it works. There are two bits commented out, a trait bounds for an Add<f32> and an
operator overload for Add<f32>. If you put those back in, you get an error trying to use the + operator.

It seems like the 2nd Add trait bound nullifies the first.

This occurs with 1.27stable and nightly as of this post. Ubuntu.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-associated-itemsArea: Associated items (types, constants & functions)E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.T-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