-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Reflect::hash collides with Hash::hash #943
Labels
C-Code-Quality
A section of code that is hard to understand or change
Comments
Hmm yeah thats a bit of a papercut. I think its worth resolving the conflict on the Reflect side. I'm thinking we should probably just rename each reflect "trait impl" method to something like |
Moxinilian
added
the
C-Code-Quality
A section of code that is hard to understand or change
label
Nov 28, 2020
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With the merging of @cart's #926, the
hash
method ofbevy::prelude::Reflect
now collides with thehash
method fromstd::hash::Hash
. You can workaround by disambiguating, so this isn't a showstopper. I'm reporting it in the hopes that there's an easy tweak to avoid having to do the workaround. If not, no big deal - and I'm fine closing this.With the following imports:
When you attempt to call the
hash
method on a primitive value like an integer (which is something you might want to do within an implementation of the Hash trait for a struct, such as on line 59 here --PlayerID
is a newtype overusize
):https://github.com/CleanCut/punchball/blob/9f8ddb2de2b8a91629307ee81b3f64aaa1eed1de/src/player/collision.rs#L52-L62
You get this error:
The workaround is to change
player_id.hash(state);
toHash::hash(&player_id, state);
to disambiguate.https://github.com/CleanCut/punchball/blob/a6abd16d239fb7c6ea2656990c6da16056d4ffce/src/player/collision.rs#L52-L62
The text was updated successfully, but these errors were encountered: