{"record":{"id":"5f2a32a6c07e8c1e","repo":"DioxusLabs/dioxus","slug":"only-type-and-function-declarations-are-supported","errorCode":null,"errorMessage":"Only type and function declarations are supported in FFI blocks","messagePattern":"Only type and function declarations are supported in FFI blocks","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"packages/manganis/manganis-macro/src/ffi.rs","lineNumber":318,"sourceCode":"                ));\n            }\n        };\n\n        let mut types = Vec::new();\n        let mut functions = Vec::new();\n\n        for item in &item.items {\n            match item {\n                ForeignItem::Type(ty) => {\n                    types.push(ForeignTypeDecl {\n                        name: ty.ident.clone(),\n                    });\n                }\n                ForeignItem::Fn(func) => {\n                    functions.push(ForeignFunctionDecl::from_foreign_fn(func)?);\n                }\n                _ => {\n                    return Err(syn::Error::new(\n                        item.span(),\n                        \"Only type and function declarations are supported in FFI blocks\",\n                    ));\n                }\n            }\n        }\n\n        Ok(Self {\n            source_path,\n            abi,\n            types,\n            functions,\n        })\n    }\n\n    /// Generate all the code\n    pub fn generate(&self) -> TokenStream2 {\n        match self.abi {","sourceCodeStart":300,"sourceCodeEnd":336,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/manganis/manganis-macro/src/ffi.rs#L300-L336","documentation":"`parse_with_attr` walks the extern block's items and only supports type and function declarations; any other foreign item (e.g. statics) produces this compile error. Remove unsupported items from the Swift/Kotlin FFI block.","triggerScenarios":"Thrown at packages/manganis/manganis-macro/src/ffi.rs:318 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Keep only type and function declarations inside the FFI block; move other items (impls, statics, etc.) outside of it."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"24f6a829df0dfa203961a98ea4cae21c2ff27e28","analyzedAt":"2026-08-23T07:10:14.078Z","contentChangedAt":"2026-08-23T07:10:14.078Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}