Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

non-exhaustive patterns: ReflectMut::Function(_) not covered #237

Open
shanecelis opened this issue Feb 1, 2025 · 1 comment
Open

non-exhaustive patterns: ReflectMut::Function(_) not covered #237

shanecelis opened this issue Feb 1, 2025 · 1 comment

Comments

@shanecelis
Copy link

I've been getting these errors recently on macOS 14.7.1 x86.

   Compiling bevy-inspector-egui v0.29.1
error[E0004]: non-exhaustive patterns: `ReflectMut::Function(_)` not covered
   --> /Users/shane/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy-inspector-egui-0.29.1/src/reflect_inspector/mod.rs:254:15
    |
254 |         match value.reflect_mut() {
    |               ^^^^^^^^^^^^^^^^^^^ pattern `ReflectMut::Function(_)` not covered
    |
note: `ReflectMut<'_>` defined here
   --> /Users/shane/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_reflect-0.15.1/src/kind.rs:212:1
    |
212 | pub enum ReflectMut<'a> {
    | ^^^^^^^^^^^^^^^^^^^^^^^
...
222 |     Function(&'a mut dyn Function),
    |     -------- not covered
    = note: the matched value is of type `ReflectMut<'_>`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
    |
263 ~             ReflectMut::Set(value) => self.ui_for_set(value, ui, id, options),
264 ~             ReflectMut::Function(_) => todo!(),
    |

error[E0004]: non-exhaustive patterns: `ReflectRef::Function(_)` not covered
   --> /Users/shane/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy-inspector-egui-0.29.1/src/reflect_inspector/mod.rs:307:15
    |
307 |         match value.reflect_ref() {
    |               ^^^^^^^^^^^^^^^^^^^ pattern `ReflectRef::Function(_)` not covered
    |
note: `ReflectRef<'_>` defined here
   --> /Users/shane/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_reflect-0.15.1/src/kind.rs:177:1
    |
177 | pub enum ReflectRef<'a> {
    | ^^^^^^^^^^^^^^^^^^^^^^^
...
187 |     Function(&'a dyn Function),
    |     -------- not covered
    = note: the matched value is of type `ReflectRef<'_>`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
    |
318 ~             ReflectRef::Set(value) => self.ui_for_set_readonly(value, ui, id, options),
319 ~             ReflectRef::Function(_) => todo!(),
    |

For more information about this error, try `rustc --explain E0004`.
error: could not compile `bevy-inspector-egui` (lib) due to 2 previous errors

I patched them with some todos, but I don't what should actually go in the todos place.

diff --git a/crates/bevy-inspector-egui/src/reflect_inspector/mod.rs b/crates/bevy-inspector-egui/src/reflect_inspector/mod.rs
index d9573e0..c0f5962 100644
--- a/crates/bevy-inspector-egui/src/reflect_inspector/mod.rs
+++ b/crates/bevy-inspector-egui/src/reflect_inspector/mod.rs
@@ -261,6 +261,7 @@ impl InspectorUi<'_, '_> {
             ReflectMut::Enum(value) => self.ui_for_enum(value, ui, id, options),
             ReflectMut::Opaque(value) => self.ui_for_value(value, ui, id, options),
             ReflectMut::Set(value) => self.ui_for_set(value, ui, id, options),
+            ReflectMut::Function(_value) => todo!("Handle ReflectMut::Function"),
         }
     }
 
@@ -316,6 +317,7 @@ impl InspectorUi<'_, '_> {
             ReflectRef::Enum(value) => self.ui_for_enum_readonly(value, ui, id, options),
             ReflectRef::Opaque(value) => self.ui_for_value_readonly(value, ui, id, options),
             ReflectRef::Set(value) => self.ui_for_set_readonly(value, ui, id, options),
+            ReflectRef::Function(_value) => todo!("Handle ReflectMut::Function"),
         }
     }
 
@AbelToy
Copy link

AbelToy commented Feb 5, 2025

Can reproduce this issue. It happened to me when I attempted to add bevy_mod_scripting as a dependency.

I looked into it, and ReflectRef::Function only exists when the reflect_functions bevy feature flag is enabled. Ideally bevy inspector egui would support compiling under that flag.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants