Skip to content

Compatibility issue with serde 1.0.225+ due to __private module changes #45

Description

@jermsam

serde_columnar 0.3.12 fails to compile with serde 1.0.225 and later versions due to changes in how serde exposes its __private module. serde 1.0.225 and later versions The module name became version-specific, breaking external crates that hardcode the path.:

What Changed in Serde 1.0.225
Before serde 1.0.225:

The module was always named __private
External crates could access it via serde::__private

After serde 1.0.225:
The module name is now dynamically generated using the patch version

For version 1.0.225, it becomes __private225
For version 1.0.226, it would be __private226

Problem
serde_columnar hardcodes the path serde::__private in its generated code, but this module no longer exists. The actual module is now named serde::__private225 (for version 1.0.225).

Error Example
When using serde_columnar with serde 1.0.225+, compilation fails with errors like:

error[E0433]: failed to resolve: could not find `__private` in `serde`
 --> src/encoding/arena.rs:445:1
  |
445 | #[columnar(vec, ser, de, iterable)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ could not find `__private` in `serde`
  |
  = note: this error originates in the attribute macro `columnar`

Problematic Code Locations
The issue are in
columnar_derive/src/serde/de.rs
where the macro generates code that accesses serde's private APIs:

Issue 1: Direct __private::Option usage
Location:
Location: Line ~70
in generate_normal_field() method

::serde::__private::Option::map(
    ::serde::de::SeqAccess::next_element::<#wrapper_ty>(&mut seq)?,
    |__wrap| __wrap.value
).ok_or_else(|| __A::Error::custom("DeserializeUnexpectedEnd"))?

Issue 2: Private borrow function access
Location: Lines ~100-120 in borrow_with() method
in borrow_with() method

// For Cow<str>
path.segments.push(Ident::new("serde", span).into());
path.segments.push(Ident::new("__private", span).into());
path.segments.push(Ident::new("de", span).into());
path.segments.push(Ident::new("borrow_cow_str", span).into());

// For Cow<[u8]>
path.segments.push(Ident::new("serde", span).into());
path.segments.push(Ident::new("__private", span).into());
path.segments.push(Ident::new("de", span).into());
path.segments.push(Ident::new("borrow_cow_bytes", span).into());

Issue 3: Multiple __private usages in wrap_deserialize_with()
Location: Lines ~180-210 in wrap_deserialize_with() function

phantom: ::serde::__private::PhantomData<#this_type #ty_generics>,
lifetime: ::serde::__private::PhantomData<&#delife ()>,

fn deserialize<__D>(__deserializer: __D) -> ::serde::__private::Result<Self, __D::Error>

::serde::__private::Ok(__DeserializeWith {
    value: #deserialize_with(__deserializer)?,
    phantom: ::serde::__private::PhantomData,
    lifetime: ::serde::__private::PhantomData,
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions