Closed
Description
The PR #62855 improved the situation about documenting proc macros. Thanks for that! However, I noticed a bug with it. I'm using rustc 1.39.0-nightly (6e19f3f38 2019-09-06)
.
Cargo.toml
[package]
name = "doc-bug"
version = "0.1.0"
authors = ["me"]
edition = "2018"
[dependencies]
macros = { path = "macros" }
src/lib.rs
/// Reexport `foo`.
pub use macros::foo;
/// Reexport `Bar`.
pub use macros::Bar;
/// Reexport `Baz`.
pub use macros::Baz;
macros/Cargo.toml
[package]
name = "macros"
version = "0.1.0"
authors = ["me"]
edition = "2018"
[lib]
proc-macro = true
macros/src/lib.rs
extern crate proc_macro;
use proc_macro::TokenStream;
/// Definition `foo`.
#[proc_macro]
pub fn foo(input: TokenStream) -> TokenStream {
input
}
/// Definition `Bar`.
#[proc_macro_derive(Bar)]
pub fn bar(input: TokenStream) -> TokenStream {
input
}
/// Definition `Baz`.
#[proc_macro_derive(Baz)]
pub fn baz(input: TokenStream) -> TokenStream {
input
}
Running cargo doc
results in this:
Looks like a simple typo or off-by-one or something like that bug. When using only proc_macro
and not proc_macro_derive
s, everything looks good to me.
CC @Aaron1011