Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rustdoc displays macros as macro_rules!s #76761

Closed
camelid opened this issue Sep 15, 2020 · 7 comments · Fixed by #79455
Closed

Rustdoc displays macros as macro_rules!s #76761

camelid opened this issue Sep 15, 2020 · 7 comments · Fixed by #79455
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-macros-2.0 Area: Declarative macros 2.0 (#39412) C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@camelid
Copy link
Member

camelid commented Sep 15, 2020

See for std::marker::Copy:

image

But when you click on [src]:

pub macro Copy($item:item) {
    /* compiler built-in */
}

Or for proc_macro::quote!:

image

With source:

pub macro quote($($t:tt)*) {
    /* compiler built-in */
}

Or for core::ready!, which is not a built-in:

image

pub macro ready($e:expr) {
    match $e {
        $crate::task::Poll::Ready(t) => t,
        $crate::task::Poll::Pending => {
            return $crate::task::Poll::Pending;
        }
    }
}

@rustbot modify labels: T-rustdoc C-bug

@rustbot rustbot added C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Sep 15, 2020
@jyn514
Copy link
Member

jyn514 commented Sep 15, 2020

Related: #74355

@jyn514 jyn514 added A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-macros-2.0 Area: Declarative macros 2.0 (#39412) labels Sep 15, 2020
@camelid
Copy link
Member Author

camelid commented Sep 24, 2020

I have a hunch that macro_rules! and macro are both represented as rustdoc::doctree::Macro, and then serialized to macro_rules! in rustdoc::clean and/or rustdoc::clean::inline.

@RalfJung
Copy link
Member

Cc @GuillaumeGomez

@camelid
Copy link
Member Author

camelid commented Sep 24, 2020

I would experiment to see if that is what's causing it, but I'm waiting on a build for something else 😄

@jyn514
Copy link
Member

jyn514 commented Sep 24, 2020

I would experiment to see if that is what's causing it, but I'm waiting on a build for something else 😄

https://rustc-dev-guide.rust-lang.org/building/suggested.html#working-on-multiple-branches-at-the-same-time

@camelid
Copy link
Member Author

camelid commented Sep 24, 2020

Wow, I never noticed that! That's so cool :)

@camelid
Copy link
Member Author

camelid commented Sep 24, 2020

Indeed, changing rustdoc::clean changed the output. See if you can notice my experimental change ;)

image

And for a built-in:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-macros-2.0 Area: Declarative macros 2.0 (#39412) C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants