DioxusLabs/dioxus · error · syn::Error
Only type and function declarations are supported in FFI…
Error message
Only type and function declarations are supported in FFI blocks
What it means
`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.
Solutions
- Keep only type and function declarations inside the FFI block; move other items (impls, statics, etc.) outside of it.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/manganis/manganis-macro/src/ffi.rs:318 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of DioxusLabs/dioxus@24f6a829df (2026-08-23).
Data as JSON: /api/errors/5f2a32a6c07e8c1e.
Report an issue: GitHub.
Appendix: source
Thrown at packages/manganis/manganis-macro/src/ffi.rs:318
));
}
};
let mut types = Vec::new();
let mut functions = Vec::new();
for item in &item.items {
match item {
ForeignItem::Type(ty) => {
types.push(ForeignTypeDecl {
name: ty.ident.clone(),
});
}
ForeignItem::Fn(func) => {
functions.push(ForeignFunctionDecl::from_foreign_fn(func)?);
}
_ => {
return Err(syn::Error::new(
item.span(),
"Only type and function declarations are supported in FFI blocks",
));
}
}
}
Ok(Self {
source_path,
abi,
types,
functions,
})
}
/// Generate all the code
pub fn generate(&self) -> TokenStream2 {
match self.abi {View on GitHub (pinned to 24f6a829df)