Skip to content

rustdoc lint missing_doc_code_examples not working on stable #76194

Closed
@JesHansen

Description

@JesHansen

I wanted to try out the missing_doc_code_examples rustdoc lint, but it seems to
be bugged.

I tried following the example given in the book.

Steps to reproduce:

Create a new crate:

cargo new testmissingdocs

Then edit the src/main.rs file:

#![deny(missing_doc_code_examples)]

//! Top level crate documentation

fn main() {
    println!("Hello, world!");
}

/// This function has no code examples.
pub fn add(i: i32, j: i32) -> i32 {
    i + j
}

I would now expect to get a linting error when building the crate, since the add
function is public, but does not have a code example. However, cargo build as
well as cargo doc and cargo test --doc completes without any errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-bugCategory: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions