Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bug: derived struct won't copy field docs #561

@lightsing

Description

@lightsing

eg. for a struct like this:

#[derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)]
pub struct Foo {
    /// some docs
    pub bar: String,
}

The derived ArchivedFoo won't copy the doc of Foo::bar, which cause lints failed if missing-docs is enabled:

error: missing documentation for a struct field
  --> ...
   |
   |     rkyv::Archive, rkyv::Serialize, rkyv::Deserialize
   |     ^^^^^^^^^^^^^
   |
   = note: requested on the command line with `-D missing-docs`
   = note: this error originates in the derive macro `rkyv::Archive` (in Nightly builds, run with -Z macro-backtrace for more info)

Manually fixed by:

#[derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)]
pub struct Foo {
    /// some docs
    #[rkyv(attr(doc = "some docs"))]
    pub bar: String,
}

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