Skip to content

der: Cannot invoke Encode::encoded_len() or Encode::encode() on str #1365

@abonander

Description

@abonander

str does not implement Tagged despite implementing FixedTag because the blanket impl implicitly requires Sized:

impl<T: FixedTag> Tagged for T { 
    fn tag(&self) -> Tag {
        T::TAG
    }
}

The impl should look like this instead:

impl<T: FixedTag + ?Sized> Tagged for T { 
    fn tag(&self) -> Tag {
        T::TAG
    }
}

The blanket impl of Encode has the same problem:

impl<T> Encode for T
where
    T: EncodeValue + Tagged,
{
    // ...
}

It should look like this:

impl<T> Encode for T
where
    T: EncodeValue + Tagged + ?Sized,
{
    // ...
}

Without this, it's impossible to invoke methods of Encode on str.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions