{"record":{"id":"9594973703124ad5","repo":"slint-ui/slint","slug":"called-a-not-implemented-method","errorCode":null,"errorMessage":"Called a not-implemented method","messagePattern":"Called a not-implemented method","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"helper_crates/vtable/macro/macro.rs","lineNumber":499,"sourceCode":"                default: None,\n                semi_token: Some(Default::default()),\n            }));\n\n            generated_to_fn_trait.push(ImplItemFn {\n                attrs: field.attrs.clone(),\n                vis: Visibility::Public(Default::default()),\n                modifiers: Default::default(),\n                sig: sig.clone(),\n                block: if has_self {\n                    parse_quote!({\n                        // Safety: this rely on the vtable being valid, and the ptr being a valid instance for this vtable\n                        #[allow(unsafe_code)]\n                        unsafe {\n                            let vtable = self.vtable.as_ref();\n                            if let #some(func) = vtable.#ident {\n                                func (#call_code)\n                            } else {\n                                panic!(\"Called a not-implemented method\")\n                            }\n                        }\n                    })\n                } else {\n                    // This should never happen: nobody should be able to access the Trait Object directly.\n                    parse_quote!({ panic!(\"Calling Sized method on a Trait Object\") })\n                },\n            });\n\n            if !has_self {\n                sig.inputs.insert(\n                    0,\n                    FnArg::Receiver(Receiver {\n                        attrs: Default::default(),\n                        mutability: None,\n                        self_token: Default::default(),\n                        kind: ReceiverKind::Reference(Default::default(), None, None),\n                    }),","sourceCodeStart":481,"sourceCodeEnd":517,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/helper_crates/vtable/macro/macro.rs#L481-L517","documentation":"The vtable crate's `vtable!` macro generates safe accessors for trait methods that call through an optional function pointer; when the vtable slot is None (method not implemented by the backing object), the generated code panics with 'Called a not-implemented method'. It means a caller invoked a trait method that the concrete object never registered in its vtable.","triggerScenarios":"Accessing a trait object whose vtable left a method slot None and then calling that method — typically a partially implemented vtable or calling a method from a newer trait revision against an older/default vtable.","commonSituations":"Implementing a vtable struct with `None` (or Rust default) for a required method; adding a new method to a vtable trait without updating implementations; unsafe/direct construction of vtables in FFI code.","solutions":["Fill in the missing method implementation in the vtable construction instead of None","Regenerate/compile all vtable definitions after changing the trait so slots are populated","For optional methods, check the slot (or an `has_*` helper) before calling instead of relying on the panic path","Review unsafe code that builds vtables manually to ensure every required fn pointer is set"],"exampleFix":"// before\nDropVTable { drop_in_place: Some(drop_in_place), ..Default::default() } // missing new method\n// after\nDropVTable { drop_in_place: Some(drop_in_place), new_method: Some(my_impl), ..Default::default() }","handlingStrategy":"validation","validationCode":"// before calling through the trait object, ensure the slot is implemented\n// check an availability helper or the vtable in debug\nassert!(vtable.some_method.is_some(), \"some_method not implemented in vtable\");","typeGuard":null,"tryCatchPattern":"// use std::panic::catch_unwind around experimental dynamic dispatch paths\nlet ok = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| obj.some_method()));","preventionTips":["Never leave required vtable slots as None / Default","Rebuild all dependents after changing a vtable trait","Add compile-time or test-time assertions that all slots are populated"],"tags":["vtable","rust","macros","ffi"],"backgroundTag":"method-not-implemented","analyzedSha":"bb937076de3f7919766c1f25e2e969367cf77e9a","analyzedAt":"2026-09-16T01:37:20.251Z","contentChangedAt":"2026-09-16T01:37:20.251Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}