{"record":{"id":"62268eda2a7ed337","repo":"slint-ui/slint","slug":"only-struct-with-named-field-are-supported","errorCode":null,"errorMessage":"Only `struct` with named field are supported","messagePattern":"Only `struct` with named field are supported","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"internal/core-macros/lib.rs","lineNumber":29,"sourceCode":"use proc_macro::TokenStream;\nuse quote::quote;\n\nmod slint_doc;\n\n/// This derive macro is used with structures in the run-time library that are meant\n/// to be exposed to the language. The structure is introspected for properties and fields\n/// marked with the `rtti_field` attribute and generates run-time type information for use\n/// with the interpreter.\n/// In addition all `Property<T> foo` fields get a convenient getter function generated\n/// that works on a `Pin<&Self>` receiver.\n#[proc_macro_derive(SlintElement, attributes(rtti_field))]\npub fn slint_element(input: TokenStream) -> TokenStream {\n    let input = syn::parse_macro_input!(input as syn::DeriveInput);\n\n    let fields = match &input.data {\n        syn::Data::Struct(syn::DataStruct { fields: f @ syn::Fields::Named(..), .. }) => f,\n        _ => {\n            return syn::Error::new(\n                input.ident.span(),\n                \"Only `struct` with named field are supported\",\n            )\n            .to_compile_error()\n            .into();\n        }\n    };\n\n    let mut pub_prop_field_names = Vec::new();\n    let mut pub_prop_field_names_normalized = Vec::new();\n    let mut pub_prop_field_types = Vec::new();\n    let mut property_names = Vec::new();\n    let mut property_visibility = Vec::new();\n    let mut property_types = Vec::new();\n\n    for field in fields {\n        if let Some(property_type) = property_type(&field.ty) {\n            let name = field.ident.as_ref().unwrap();","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/slint-ui/slint/blob/3fd8f2ec03c2aa8a95d5f4b9daa299c7b8bf4016/internal/core-macros/lib.rs#L11-L47","documentation":"Error \"Only `struct` with named field are supported\" thrown in slint-ui/slint.","triggerScenarios":"Thrown at internal/core-macros/lib.rs:29 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a struct with named fields with this macro.","Convert tuple structs into named-field structs."],"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"}