databendlabs/databend · error
unsupported type
Error message
unsupported type
What it means
A generic compile-time guard in emit_walk_for_type of the visit_derive macro: the field or variant type is not a Type::Path (e.g. it is a reference, slice, tuple, function pointer, or other exotic type), so the macro cannot resolve it to a Walk/WalkMut impl. It fires when derive(Walk)/derive(WalkMut) is applied to a type containing such a field, aborting the derive expansion.
Solutions
- Use a supported type path in the derived field: primitives, Box, Option, Vec, or types implementing Walk/WalkMut.
- If the field is a custom non-Walk type, wrap it in a newtype and implement Walk manually, or skip the field via #[visit(skip)] if the derive supports it.
- For type paths with no last segment (e.g. exotic syn::Type paths), restructure the field declaration to a plain named type.
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at src/query/ast/visit_derive/src/lib.rs:197 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of databendlabs/databend@288d84d76e (2026-09-11).
Data as JSON: /api/errors/c0f137805bf3ec19.
Report an issue: GitHub.
Appendix: source
Thrown at src/query/ast/visit_derive/src/lib.rs:197
})
}
fn emit_field_stmt(
field: &Field,
access: TokenStream2,
mutable: bool,
) -> syn::Result<TokenStream2> {
emit_walk_for_type(&field.ty, access, mutable)
}
fn emit_walk_for_type(ty: &Type, access: TokenStream2, mutable: bool) -> syn::Result<TokenStream2> {
match ty {
Type::Path(type_path) => {
let segment = type_path
.path
.segments
.last()
.ok_or_else(|| Error::new(type_path.span(), "unsupported type"))?;
let name = segment.ident.to_string();
if is_primitive_noop_leaf(&name) {
return Ok(TokenStream2::new());
}
let trait_name = if mutable {
quote!(crate::visit::WalkMut)
} else {
quote!(crate::visit::Walk)
};
let method = if mutable {
quote!(walk_mut)
} else {
quote!(walk)
};
Ok(quote! {
match #trait_name::#method(#access, visitor)? {View on GitHub (pinned to 288d84d76e)