{"record":{"id":"ae1e540185398313","repo":"slint-ui/slint","slug":"self-pointer-need-to-be-the-first","errorCode":null,"errorMessage":"Self pointer need to be the first","messagePattern":"Self pointer need to be the first","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"helper_crates/vtable/macro/macro.rs","lineNumber":340,"sourceCode":"                    call_code = Some(quote!(vtable as _,));\n                    continue;\n                }\n\n                let (is_pin, self_ty) = match is_pin(&param.ty) {\n                    Some(t) => (true, t),\n                    None => (false, &param.ty),\n                };\n\n                // check for self\n                if let (true, mutability) = if match_generic_type(self_ty, \"VRef\", &vtable_name) {\n                    (true, None)\n                } else if match_generic_type(self_ty, \"VRefMut\", &vtable_name) {\n                    (true, Some(Default::default()))\n                } else {\n                    (false, None)\n                } {\n                    if !sig.inputs.is_empty() {\n                        return Error::new(param.span(), \"Self pointer need to be the first\")\n                            .to_compile_error()\n                            .into();\n                    }\n\n                    let const_or_mut = mutability.map_or_else(|| quote!(const), |x| quote!(#x));\n                    has_self = true;\n                    if !is_pin {\n                        sig.inputs.push(FnArg::Receiver(Receiver {\n                            attrs: param.attrs.clone(),\n                            mutability: None,\n                            self_token: Default::default(),\n                            kind: ReceiverKind::Reference(Default::default(), None, mutability),\n                        }));\n                        call_code =\n                            Some(quote!(#call_code <#self_ty>::from_raw(self.vtable, self.ptr),));\n                        self_call =\n                            Some(quote!(&#mutability (*(#arg_name.as_ptr() as *#const_or_mut T)),));\n                    } else {","sourceCodeStart":322,"sourceCodeEnd":358,"githubUrl":"https://github.com/slint-ui/slint/blob/3fd8f2ec03c2aa8a95d5f4b9daa299c7b8bf4016/helper_crates/vtable/macro/macro.rs#L322-L358","documentation":"Error \"Self pointer need to be the first\" thrown in slint-ui/slint.","triggerScenarios":"Thrown at helper_crates/vtable/macro/macro.rs:340 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Place the self pointer as the first field/member as required by the macro.","Reorder the fields so the self pointer comes first."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3fd8f2ec03c2aa8a95d5f4b9daa299c7b8bf4016","analyzedAt":"2026-08-19T23:23:16.610Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}