+
Skip to content

#![deny(missing_docs)] fails on derived archived enum variants #596

@tv42

Description

@tv42

This looks like #217 again. It seems ArchivedFoo enum variants don't have doc strings. Either they could get docstrings, or #[expect(missing_docs, reason = "generated code")] or something.

//! Repro for an rkyv bug

#![deny(missing_docs)]

/// doc for enum
#[derive(rkyv::Archive)]
pub enum A {
    /// doc for variant
    Variant {
        /// doc for field
        field: (),
    },
}

/// doc for enum
#[derive(rkyv::Archive)]
// Can't seem to special case allow it, this doesn't apply to enum variants?
#[rkyv(attr(expect(missing_docs)))]
pub enum B {
    /// doc for variant
    Variant {
        /// doc for field
        field: (),
    },
}

/// doc for enum
#[derive(rkyv::Archive)]
#[rkyv(derive(Debug), attr(expect(missing_docs)))]
pub enum C {
    /// doc for variant
    // Can't special case allow it this way either.
    #[rkyv(attr(expect(missing_docs)))]
    Variant {
        /// doc for field
        field: (),
    },
}
$ cargo clippy
    Checking rkyv-missing-docs-issue v0.1.0 (/workspace/rkyv-missing-docs-issue)
error: missing documentation for a struct field
 --> src/lib.rs:6:10
  |
6 | #[derive(rkyv::Archive)]
  |          ^^^^^^^^^^^^^
  |
note: the lint level is defined here
 --> src/lib.rs:3:9
  |
3 | #![deny(missing_docs)]
  |         ^^^^^^^^^^^^
  = note: this error originates in the derive macro `rkyv::Archive` (in Nightly builds, run with -Z macro-backtrace for more info)

error: missing documentation for a struct field
 --> src/lib.rs:6:10
  |
6 | #[derive(rkyv::Archive)]
  |          ^^^^^^^^^^^^^
  |
  = note: this error originates in the derive macro `rkyv::Archive` (in Nightly builds, run with -Z macro-backtrace for more info)

error: missing documentation for a struct field
  --> src/lib.rs:16:10
   |
16 | #[derive(rkyv::Archive)]
   |          ^^^^^^^^^^^^^
   |
   = note: this error originates in the derive macro `rkyv::Archive` (in Nightly builds, run with -Z macro-backtrace for more info)

error: missing documentation for a struct field
  --> src/lib.rs:28:10
   |
28 | #[derive(rkyv::Archive)]
   |          ^^^^^^^^^^^^^
   |
   = note: this error originates in the derive macro `rkyv::Archive` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `rkyv-missing-docs-issue` (lib) due to 4 previous errors

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

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载