bevyengine/bevy · error

Underlying type does not reflect `PartialEq` and hence doesn

Error message

Underlying type does not reflect `PartialEq` and hence doesn't support equality checks

What it means

Panic in DynamicSet's internal_eq: equality comparison was attempted on values whose underlying type does not implement reflected PartialEq, so the result of reflect_partial_eq is an error rather than a bool.

Source

Thrown at crates/bevy_reflect/src/set.rs:195

        self.represented_type = represented_type;
    }

    /// Inserts a typed value into the set.
    pub fn insert<V: Reflect>(&mut self, value: V) {
        self.insert_boxed(Box::new(value));
    }

    fn internal_hash(value: &dyn PartialReflect) -> u64 {
        value.reflect_hash().expect(&hash_error!(value))
    }

    fn internal_eq(
        value: &dyn PartialReflect,
    ) -> impl FnMut(&Box<dyn PartialReflect>) -> bool + '_ {
        |other| {
            value
                .reflect_partial_eq(&**other)
                .expect("Underlying type does not reflect `PartialEq` and hence doesn't support equality checks")
        }
    }
}

impl Set for DynamicSet {
    fn get(&self, value: &dyn PartialReflect) -> Option<&dyn PartialReflect> {
        self.hash_table
            .find(Self::internal_hash(value), Self::internal_eq(value))
            .map(|value| &**value)
    }

    fn len(&self) -> usize {
        self.hash_table.len()
    }

    fn iter(&self) -> Box<dyn Iterator<Item = &dyn PartialReflect> + '_> {
        let iter = self.hash_table.iter().map(|v| &**v);
        Box::new(iter)

View on GitHub (pinned to 8d743eb7dc)

Solutions

  1. Add #[reflect(PartialEq)] to the element types stored in the set
  2. Avoid inserting non-PartialEq types into reflected sets
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/bevy_reflect/src/set.rs:193 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of bevyengine/bevy@8d743eb7dc (2026-08-20). Data as JSON: /api/errors/3db0f5f2556be45b. Report an issue: GitHub.