Stream: rustdoc

Topic: Json output lacks some item which are supposed to be there


view this post on Zulip Hirochika Matsumoto (Aug 19 2021 at 15:45):

In developing roogle I noticed the output of rustdoc lacks items which the target crates has.
I'm using the json output of the standard library std generated by the rustdoc I patched, and the output does not contain items like char::is_uppercase. I suppose that this line is pushing the items away, but in that case I think the swapped items should be present in the output, but not...

view this post on Zulip Joshua Nelson (Aug 19 2021 at 15:47):

@Hirochika Matsumoto you've commented out the assert that would panic rustdoc when that situation occurs

view this post on Zulip Joshua Nelson (Aug 19 2021 at 15:47):

there are already lots of open bugs about the assert triggerring

view this post on Zulip Joshua Nelson (Aug 19 2021 at 15:47):

there's no simple fix or it would have been fixed already

view this post on Zulip Joshua Nelson (Aug 19 2021 at 15:52):

https://github.com/rust-lang/rust/issues/83720 and https://github.com/rust-lang/rust/issues/83718 are a couple of the issues

view this post on Zulip Hirochika Matsumoto (Aug 19 2021 at 15:53):

@Joshua Nelson Thanks I'll take a look! A-rustdoc-json label is the label for this I guess?

view this post on Zulip Joshua Nelson (Aug 19 2021 at 15:53):

yup

view this post on Zulip Joshua Nelson (Aug 19 2021 at 16:01):

thank you for working on it!

view this post on Zulip Hirochika Matsumoto (Aug 19 2021 at 16:20):

By searching for use [a-zA-Z0-9_]* as [a-zA-Z0-9_]*;$ it turned out that is_uppercase nor char is reexported, so some orthogonal problems are the cause.
I used cargo +stage1 rustdoc -- --output-format json -Z unstable-options on <path to local rust clone>/library/std to get a json file. Do you think this does the trick?

view this post on Zulip Joshua Nelson (Aug 19 2021 at 16:27):

what do you mean by "does the trick"?

view this post on Zulip Joshua Nelson (Aug 19 2021 at 16:27):

I would expect that to generate the .json file if that's what you mean

view this post on Zulip Hirochika Matsumoto (Aug 19 2021 at 18:36):

Joshua Nelson said:

I would expect that to generate the .json file if that's what you mean

Yes that's what I meant.

view this post on Zulip Hirochika Matsumoto (Aug 19 2021 at 18:38):

Okay, the problem is occurring because rustdoc's json backend somehow ignores/skips some kind of items (functions, impls at least) which has `#[lang = "..."] in its attributes.

view this post on Zulip Joshua Nelson (Aug 19 2021 at 18:40):

oh fun

view this post on Zulip Joshua Nelson (Aug 19 2021 at 18:40):

on the bright side, that is probably an easy fix if you can find where to put it

view this post on Zulip Hirochika Matsumoto (Aug 19 2021 at 18:41):

Yup, the html backend does not skip them, so I suppose comparing two backends will show me where to edit

view this post on Zulip Hirochika Matsumoto (Aug 22 2021 at 12:50):

@Joshua Nelson I've managed to solve this problem! The cause was that, impls are indexed here but the if-lets don't cover impl <prim ty> case.

view this post on Zulip Joshua Nelson (Aug 22 2021 at 12:51):

That's great! Could you make a PR with the fix? Feel free to ask me to review, I'm jyn514 on GitHub :)

view this post on Zulip Hirochika Matsumoto (Aug 22 2021 at 12:51):

The patched rustdoc https://github.com/hkmatsumoto/rust/commit/f598ac1bd766d7ee87611c0ad6eb6e355b62b3d0 correctly indexes prmimitives :)

view this post on Zulip Hirochika Matsumoto (Aug 22 2021 at 12:51):

Ok, I'll send a PR


Last updated: Oct 11 2021 at 22:34 UTC