Closed
Description
The missing_doc_code_examples
lint seems to be erroneously complaining about missing documentation examples where local types implement foreign traits (both from 3rd party crates and the standard library).
The example below should pass all checks as far as I can tell:
/// Foo.
pub struct Foo {
/// Bar.
pub bar: i32,
/// Baz.
pub baz: i32,
}
impl Neg for Foo {
type Output = Self;
#[inline]
fn neg(self) -> Self::Output {
Self::Output {
bar: -self.bar,
baz: -self.baz,
}
}
}
However, running cargo doc
results in the following warnings:
warning: missing code example in this documentation
--> foo.rs:9:1
|
| / impl Neg for Foo {
| | type Output = Self;
| |
| | #[inline]
... |
| | }
| | }
| |_^
warning: missing code example in this documentation
--> foo.rs:13:3
|
| / fn neg(self) -> Self::Output {
| | Self::Output {
| | bar: -self.bar,
| | baz: -self.baz,
| | }
| | }
| |___^
Meta
rustc --version --verbose
:
rustc 1.48.0-nightly (73dc675b9 2020-09-06)
binary: rustc
commit-hash: 73dc675b9437c2a51a975a9f58cc66f05463c351
commit-date: 2020-09-06
host: x86_64-pc-windows-msvc
release: 1.48.0-nightly
LLVM version: 11.0
Metadata
Metadata
Assignees
Labels
Area: Calculating how much of a crate has documentationArea: Lints (warnings about flaws in source code) such as unused_mut.Category: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.Relevant to the rustdoc team, which will review and decide on the PR/issue.This issue requires a nightly compiler in some way.