-
Notifications
You must be signed in to change notification settings - Fork 13k
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
ICE: refcell panic in rustdoc on facade crate #48414
Comments
Panic occurs because the recursive call here still holds the borrow for the rust/src/librustdoc/clean/inline.rs Lines 496 to 500 in 27a046e
|
The relevant culprit for intra-links is this line right here: rust/src/librustdoc/clean/mod.rs Line 1169 in 27a046e
Because it kicks off the second |
We can also not use the entry API and do it manually? |
That's my thought; just check for the presence of the key, bail early, then build the external trait without holding a borrow on |
I have a build already, want me to do it? |
This doesn't work because this leads to a stack overflow where we recursively keep trying to register the def. We need to buffer it up or something. |
…-traits, r=Manishearth rustdoc: don't crash when an external trait's docs needs to import another trait Fixes rust-lang#48414 When resolving intra-paths for an item, rustdoc needs to have information about their items on hand, for proper bookkeeping. When loading a path for an external item, it needs to load these items from their host crate, since their information isn't otherwise available. This includes resolving paths for those docs. which can cause this process to recurse. Rustdoc keeps a map of external traits in a `RefCell<HashMap<DefId, Trait>>`, and it keeps a borrow of this active when importing an external trait. In the linked crash, this led to a RefCell borrow error, panic, and ICE. This PR manually releases the borrow while importing the trait, and also keeps a list of traits being imported at the given moment. The latter keeps rustdoc from infinitely recursing as it tries to import the same trait repeatedly.
I got the following ICE when running
cargo doc
on a facade crate that re-exports various types that use intra-rustdoc links:The text was updated successfully, but these errors were encountered: