-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-decl-macros-2-0Area: Declarative macros 2.0 (#39412)Area: Declarative macros 2.0 (#39412)A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.
Description
proc-macro-lib
crates, when compiled with -W missing-docs
, generate invalid warnings about missing documentation.
The following simple crate demonstrates the error.
src/lib.rs
:
//! Custom derive module
extern crate proc_macro;
use proc_macro::TokenStream;
/// Derive IntoIterator
#[proc_macro_derive(IntoIterator)]
pub fn into_iterator(_input: TokenStream) -> TokenStream {
unimplemented!()
}
Cargo.toml
:
[package]
name = "tmp"
version = "0.1.0"
[lib]
proc-macro = true
I expect this to compile cleanly since there is a crate-level doc comment and a doc comment for the public function.
Instead, compiling gives:
warning: missing documentation for a module [-W missing-docs]
--> src/lib.rs:1:1
|
1 | //! Custom derive module
| ^
warning: missing documentation for a function [-W missing-docs]
--> src/lib.rs:1:1
|
1 | //! Custom derive module
| ^
which makes no sense since line 1 is a comment.
Compiler version - latest stable, but fails on yesterday's nightly (2017-05-14) too:
rustc --version --verbose
:
rustc 1.17.0 (56124baa9 2017-04-24)
binary: rustc
commit-hash: 56124baa9e73f28c0709e59e74783cf234a978cf
commit-date: 2017-04-24
host: x86_64-unknown-linux-gnu
release: 1.17.0
LLVM version: 3.9
Metadata
Metadata
Assignees
Labels
A-decl-macros-2-0Area: Declarative macros 2.0 (#39412)Area: Declarative macros 2.0 (#39412)A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.