Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/libsyntax_ext/proc_macro_decls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ impl<'a> Visitor<'a> for CollectProcMacros<'a> {

// Creates a new module which looks like:
//
// #[doc(hidden)]
// mod $gensym {
// extern crate proc_macro;
//
Expand Down Expand Up @@ -357,6 +358,10 @@ fn mk_decls(
});
let span = DUMMY_SP.apply_mark(mark);

let hidden = cx.meta_list_item_word(span, Symbol::intern("hidden"));
let doc = cx.meta_list(span, Symbol::intern("doc"), vec![hidden]);
let doc_hidden = cx.attribute(span, doc);

let proc_macro = Ident::from_str("proc_macro");
let krate = cx.item(span,
proc_macro,
Expand Down Expand Up @@ -421,7 +426,7 @@ fn mk_decls(
span,
span,
ast::Ident::with_empty_ctxt(Symbol::gensym("decls")),
vec![],
vec![doc_hidden],
vec![krate, decls_static],
).map(|mut i| {
i.vis = respan(span, ast::VisibilityKind::Public);
Expand Down
16 changes: 16 additions & 0 deletions src/test/ui/proc-macro/no-missing-docs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//! Verify that the `decls` module implicitly added by the compiler does not cause `missing_docs`
//! warnings.

// compile-pass
// force-host
// no-prefer-dynamic

#![crate_type = "proc-macro"]
#![deny(missing_docs)]

extern crate proc_macro;
use proc_macro::*;

/// Foo1.
#[proc_macro]
pub fn foo1(input: TokenStream) -> TokenStream { input }