You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the merging of @cart's #926, the hash method of bevy::prelude::Reflect now collides with the hash method from std::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:
use bevy::prelude::*;use std::hash::Hash;
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 over usize):
error[E0034]: multiple applicable items in scope
--> src/player/collision.rs:58:23
|
58 | player_id.hash(state);
| ^^^^ multiple `hash` found
|
= note: candidate #1 is defined in an impl of the trait `Hash` for the type `usize`
= note: candidate #2 is defined in an impl of the trait `bevy::prelude::Reflect` for the type `usize`
help: disambiguate the associated function for candidate #1
|
58 | Hash::hash(&player_id, state);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the associated function for candidate #2
|
58 | bevy::prelude::Reflect::hash(&player_id, state);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0034`.
The workaround is to change player_id.hash(state); to Hash::hash(&player_id, state); to disambiguate.
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 reflect_hash().
…eflect_partial_eq` (#954)
* Rename reflect 'hash' method to 'reflect_hash' to avoid colliding with std::hash::Hash::hash to resolve#943.
* Rename partial_eq to reflect_partial_eq to avoid collisions with implementations of PartialEq on primitives.
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: