quickwit-oss/quickwit · error · proc-macro compile error

structure doesn't implement serialize but a serializer is de

Error message

structure doesn't implement serialize but a serializer is defined

What it means

The inverse of error 325: a field declares an `into` (serializer) conversion but the struct does not implement Serialize, so the conversion would be dead code. The macro rejects this inconsistency at compile time.

Source

Thrown at quickwit/quickwit-macros/src/lib.rs:188

        if let Some(field_config) = field_config {
            let value = Ident::new("value", Span::call_site());
            for field in &field_config.proxy_fields {
                final_fields.push(field.clone());
            }
            match (ser, field_config.get_into(&value)) {
                (true, Some((pre_conv, in_conv))) => {
                    into_pre_conv.push(pre_conv);
                    into_in_conv.push(in_conv);
                }
                (false, None) => (),
                (true, None) => {
                    return Err(Error::new(
                        field_name.span(),
                        "structure implement serialize but no serializer defined",
                    ));
                }
                (false, Some(_)) => {
                    return Err(Error::new(
                        field_name.span(),
                        "structure doesn't implement serialize but a serializer is defined",
                    ));
                }
            }
            match (de, field_config.get_try_from(&value)) {
                (true, Some(conv)) => {
                    try_from_conv.push(conv);
                }
                (false, None) => (),
                (true, None) => {
                    return Err(Error::new(
                        field_name.span(),
                        "structure implement deserialize but no deserializer defined",
                    ));
                }
                (false, Some(_)) => {
                    return Err(Error::new(

View on GitHub (pinned to a39730c5cd)

Solutions

  1. Add Serialize to the struct's derives if serialization is intended.
  2. Or remove the unused `into` conversion from the field config.

Example fix

// before
#[derive(Deserialize)]
#[serde_multikey(fields(v(into = to_str)))]
struct Foo { v: u64 }
// after
#[derive(Serialize, Deserialize)]
#[serde_multikey(fields(v(into = to_str)))]
struct Foo { v: u64 }
Defensive patterns

Strategy: validation

Validate before calling

// Only define `into` conversions on structs that derive Serialize:
// #[derive(Serialize)] or #[derive(Serialize, Deserialize)] + into = ...

Prevention

When it happens

Trigger: Struct has only #[derive(Deserialize)] (no Serialize) yet a field config in #[serde_multikey(...)] defines an `into`/serializer conversion.

Common situations: Copy-pasting a fully-specified field config from a Serialize+Deserialize struct into a deserialize-only struct.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of quickwit-oss/quickwit@a39730c5cd (2026-09-08). Data as JSON: /api/errors/c25f6ea7eaa9f692. Report an issue: GitHub.