Stream: rustdoc

Topic: Panic in json-format


view this post on Zulip Nixon Enraght-Moony (Dec 04 2020 at 22:27):

Turns out that change around CRATE_DEF_INDEX was deffinatly needed. I'm working on a minimal reproduction here. More details to come as I figure it out

view this post on Zulip Joshua Nelson (Dec 04 2020 at 22:30):

do you know yet why it's necessary? It seems like output.root is getting overridden with an import somehow? I'd expect that to need larger changes than changing the DefId, lots of rustdoc has fake defids

view this post on Zulip Nixon Enraght-Moony (Dec 04 2020 at 22:35):

Yeah, it seems like something else is getting Id 0:0, and that messes up the assuptions about what root has.

view this post on Zulip Nixon Enraght-Moony (Dec 04 2020 at 23:14):

Minimal:

pub mod l1 {
    pub mod l3 {
        pub struct L4;
    }
    pub use l3::L4;
}

view this post on Zulip Nixon Enraght-Moony (Dec 05 2020 at 00:07):

Checking the inserts are unique, it turns out theirs a lot of collisions

view this post on Zulip Joshua Nelson (Dec 05 2020 at 00:09):

Yeah I think rustdoc reuses DefIds for a lot of things

view this post on Zulip Joshua Nelson (Dec 05 2020 at 00:09):

Maybe a fix is to use a different id that's unique and unrelated to DefIds?

view this post on Zulip Nixon Enraght-Moony (Dec 05 2020 at 00:13):

Would that be any simpler than not reusing DefIds. They seem to be unique in the compiller. Any reasons they can't be made unique?

view this post on Zulip Joshua Nelson (Dec 05 2020 at 00:27):

well, it's unique within the compiler, but not within rustdoc

view this post on Zulip Joshua Nelson (Dec 05 2020 at 00:28):

hmm, actually I'm having trouble finding where it's duplicated other than in that one case

view this post on Zulip Joshua Nelson (Dec 05 2020 at 00:29):

maybe we could just use cx.next_def_id?

view this post on Zulip Joshua Nelson (Dec 05 2020 at 00:29):

but that seems like a hack - you can't pass those DefIds to anything in rustc

view this post on Zulip Joshua Nelson (Dec 05 2020 at 00:29):

it will panic

view this post on Zulip Nixon Enraght-Moony (Dec 05 2020 at 12:53):

Using cx.tcx.hir().local_def_id(self.id).to_def_id(), seems to fix the problem, but items are still being removed from the index, but curiously by themselves. Details.

It looks like <JsonRenderer as FormatRenderer>::item is being called more that once, but I'm not sure why that would be

view this post on Zulip Nixon Enraght-Moony (Dec 05 2020 at 15:25):

It this a bug that it's calling item with the same item twice?

view this post on Zulip Joshua Nelson (Dec 05 2020 at 15:28):

probably, I would investigate what's calling item twice

view this post on Zulip Joshua Nelson (Dec 05 2020 at 15:28):

the main HTML backend wouldn't notice, it would just overwrite the files

view this post on Zulip Nixon Enraght-Moony (Dec 05 2020 at 22:34):

Pull that makes it work, but doesn't address the underlying duplication, as I haven't found it yet.


Last updated: Oct 11 2021 at 22:34 UTC