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

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

Closed
jackmott opened this issue Jul 3, 2018 · 3 comments · Fixed by #86393
Closed

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

jackmott opened this issue Jul 3, 2018 · 3 comments · Fixed by #86393
Labels
A-associated-items Area: Associated items (types, constants & functions) E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jackmott
Copy link

jackmott commented Jul 3, 2018

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.

@jackmott
Copy link
Author

jackmott commented Jul 4, 2018

appears to be related to:
#24159 and #47897

@jackmott
Copy link
Author

jackmott commented Jul 4, 2018

more info: whichever trait bounds appears last in the list on the trait, will work, the one before will not.

@memoryruins memoryruins added the A-associated-items Area: Associated items (types, constants & functions) label Sep 15, 2018
@estebank estebank added E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 2, 2021
@estebank
Copy link
Contributor

estebank commented Feb 2, 2021

This now compiles.

yerke added a commit to yerke/rust that referenced this issue Jun 22, 2021
JohnTitor added a commit to JohnTitor/rust that referenced this issue Jun 22, 2021
bors added a commit to rust-lang-ci/rust that referenced this issue Jun 22, 2021
Rollup of 6 pull requests

Successful merges:

 - rust-lang#86393 (Add regression test for issue rust-lang#52025)
 - rust-lang#86402 (rustdoc: add optional woff2 versions of Source Serif and Source Code)
 - rust-lang#86451 (Resolve intra-doc links in summary desc)
 - rust-lang#86501 (Cleanup handling of `crate_name` for doctests)
 - rust-lang#86517 (Fix `unused_unsafe` around `await`)
 - rust-lang#86537 (Mark some edition tests as check-pass)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors closed this as completed in 0cfaa27 Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-associated-items Area: Associated items (types, constants & functions) E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. 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.

3 participants