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: leaves alias type's documetation empty #107690

Closed
timthelion opened this issue Feb 5, 2023 · 6 comments
Closed

Rustdoc: leaves alias type's documetation empty #107690

timthelion opened this issue Feb 5, 2023 · 6 comments
Labels
C-bug Category: This is a bug.

Comments

@timthelion
Copy link

Types that are generated by a macro from another type using a decorator end up with empty documentation. Here is an example

I expected to see this happen: I expected to see the fields and methods I can use with objects of this type. For example, I know from context that this type has a content attribute but no such attribute is shown in the docs.

Example code from the same project:

async fn on_room_message(event: OriginalSyncRoomMessageEvent, room: Room) {
    if let Room::Joined(room) = room {
        let MessageType::Text(text_content) = event.content.msgtype else {
            return;
        };

        if text_content.body.contains("!party") {
            let content = RoomMessageEventContent::text_plain("🎉🎊🥳 let's PARTY!! 🥳🎊🎉");

            println!("sending");

            // send our message to the room we found the "!party" command in
            // the last parameter is an optional transaction id which we don't
            // care about.
            room.send(content, None).await.unwrap();

            println!("message sent");
        }
    }
}

Instead, this happened:

image

@timthelion timthelion added the C-bug Category: This is a bug. label Feb 5, 2023
@jyn514
Copy link
Member

jyn514 commented Feb 5, 2023

@timthelion do you see the same problem if you write out the type alias without a macro? If so, it's probably related to the alias, not the macro.

@timthelion
Copy link
Author

timthelion commented Feb 5, 2023

I'm sorry but I don't know what the type alias without the macro is. I didn't write the code in question and I'm still quite new to rust.

@jyn514
Copy link
Member

jyn514 commented Feb 5, 2023

The one shown in the docs, pub type OriginalSyncRoomMessageEvent = OriginalSyncMessageLikeEvent<RoomMessageEventContent>;

@timthelion
Copy link
Author

Oh, wow, I didn't realize that. So basically it would be fixed if the docs contained the same thing as this page https://docs.rs/ruma/0.7.4/ruma/events/struct.OriginalSyncMessageLikeEvent.html but with C replaced with RoomMessageEventContent. Or maybe we can somehow detect that there is a type alias and change the UX like so:

image

@timthelion timthelion changed the title Rustdoc: leaves documentation for types generated by macros empty Rustdoc: leaves alias type's documetation empty Feb 6, 2023
@fmease
Copy link
Member

fmease commented Feb 6, 2023

Duplicate of feature request #99952.

@timthelion
Copy link
Author

@fmease yeah, probably, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants