Stream: rustdoc

Topic: Remove doctree::Macro


view this post on Zulip CraftSpider (Nov 26 2020 at 18:51):

I know @Joshua Nelson has been working on removing doctree types. Would it be duplicated effort for me to look at removing doctree::Macro, or a welcome break up of effort? I say this because I was looking at issue rust/76761, and figured it would be better to remove the Macro object before making any changes, instead of after.

view this post on Zulip Joshua Nelson (Nov 26 2020 at 18:55):

that would be really great!

view this post on Zulip Joshua Nelson (Nov 26 2020 at 18:55):

the relevant bit is https://github.com/rust-lang/rust/blob/65ecc481fac7ceced57d973a580d0a7ccbdcb192/src/librustdoc/visit_ast.rs#L343

view this post on Zulip Joshua Nelson (Nov 26 2020 at 18:56):

the idea is to, instead of returning a new Macro there and storing it on the output module (om), store the MacroDef directly instead

view this post on Zulip Joshua Nelson (Nov 26 2020 at 18:57):

however it shouldn't change the behavior, so anything tricky going on in visit_ast should be moved to https://github.com/rust-lang/rust/blob/master/src/librustdoc/clean/mod.rs instead

view this post on Zulip Joshua Nelson (Nov 26 2020 at 18:57):

there should be an impl Clean for doctree::Macro somewhere

view this post on Zulip CraftSpider (Nov 26 2020 at 18:58):

Yep, I already have the impl up on my screen, and I'm looking through your merged PRs for where else I'll need to look. Thank you for the help

view this post on Zulip Joshua Nelson (Nov 26 2020 at 18:59):

https://github.com/rust-lang/rust/pull/79372 makes some changes to from_def_id_and_kind, but not super major, just enough that it will be annoying to rebase over

view this post on Zulip CraftSpider (Nov 26 2020 at 19:11):

Annoying thing: A macro ends up coming from a hir::MacroDef instead of a hir::Item (They are almost identical structs, with the difference being Item has a kind: ItemKind<'hir> and MacroDef has an ast: ast::MacroDef). I guess clean::Module keeps a seperate macro vector, instead of adding them to items, but they're added as a (MacroDef, Option<Ident>) now.

view this post on Zulip Joshua Nelson (Nov 26 2020 at 19:12):

sure, seems reasonable

view this post on Zulip CraftSpider (Nov 26 2020 at 19:43):

Joshua Nelson said:

https://github.com/rust-lang/rust/pull/79372 makes some changes to from_def_id_and_kind, but not super major, just enough that it will be annoying to rebase over

It looks like that was approved, so I may wait till that's merged and I can pull it in, then commit. That way all my changes are on top of it.

view this post on Zulip Joshua Nelson (Nov 26 2020 at 20:13):

you don't need to wait until it's merged, you can rebase on top of it

view this post on Zulip Joshua Nelson (Nov 26 2020 at 20:13):

git fetch origin pull/79372/head && git rebase FETCH_HEAD

view this post on Zulip CraftSpider (Nov 26 2020 at 23:47):

Opened https://github.com/rust-lang/rust/pull/79455


Last updated: Oct 11 2021 at 22:34 UTC