-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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: Fix ICE for intra-doc link on intermediate re-export #109330
rustdoc: Fix ICE for intra-doc link on intermediate re-export #109330
Conversation
Some changes occurred in src/librustdoc/clean/types.rs cc @camelid |
This comment has been minimized.
This comment has been minimized.
Blocked on #109312. |
This comment was marked as resolved.
This comment was marked as resolved.
a685837
to
c8c342c
Compare
Rebased. @bors ready |
I used As for
I think none of these options is better than the current status so I preferred to keep it as is. One think I did though was to remove its |
@GuillaumeGomez |
Sure. |
Checked the 3 issues with the fix and the 3 still fail. |
@bors r+ |
…llaumeGomez Rollup of 6 pull requests Successful merges: - rust-lang#109330 (rustdoc: Fix ICE for intra-doc link on intermediate re-export) - rust-lang#109354 (Remove the `NodeId` of `ast::ExprKind::Async`) - rust-lang#109445 (Allow passing the --nocapture flag to compiletest) - rust-lang#109512 (bump `askama_derive` to 0.12.1) - rust-lang#109637 (Add missing needs-asm-support annotation to ui/simple_global_asm.rs) - rust-lang#109666 (Correct ASCII case comment) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
let mut visitor = OneLevelVisitor::new(hir_map, target_def_id); | ||
let mut visited = FxHashSet::default(); | ||
|
||
// If the item is an import and has at least a path with two parts, we go into it. | ||
while let hir::ItemKind::Use(path, _) = item.kind && visited.insert(item.hir_id()) { | ||
let import_parent = cx.tcx.opt_local_parent(prev_import).map(|def_id| def_id.to_def_id()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GuillaumeGomez
This PR wasn't rebased correctly, after #109312 doc fragment contain ids of imports themselves, not their parent modules.
This is most likely the reason why this PR doesn't fix the rustix
issues it was supposed to fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed this during rebase of #109500.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh. It's surprising that the test I added was still working then. Well, great that your PR fixed it.
resolve: Preserve reexport chains in `ModChild`ren This may be potentially useful for - avoiding uses of `hir::ItemKind::Use` (which usually lead to correctness issues) - preserving documentation comments on all reexports, including those from other crates - preserving and checking stability/deprecation info on reexports - all kinds of diagnostics The second commit then migrates some hacky logic from rustdoc to `module_reexports` to make it simpler and more correct. Ideally rustdoc should use `module_reexports` immediately at the top level, so `hir::ItemKind::Use`s are never used. The second commit also fixes issues with rust-lang#109330 and therefore Fixes rust-lang#109631 Fixes rust-lang#109614 Fixes rust-lang#109424
resolve: Preserve reexport chains in `ModChild`ren This may be potentially useful for - avoiding uses of `hir::ItemKind::Use` (which usually lead to correctness issues) - preserving documentation comments on all reexports, including those from other crates - preserving and checking stability/deprecation info on reexports - all kinds of diagnostics The second commit then migrates some hacky logic from rustdoc to `module_reexports` to make it simpler and more correct. Ideally rustdoc should use `module_reexports` immediately at the top level, so `hir::ItemKind::Use`s are never used. The second commit also fixes issues with rust-lang/rust#109330 and therefore Fixes rust-lang/rust#109631 Fixes rust-lang/rust#109614 Fixes rust-lang/rust#109424
Fixes #109282.
This PR is based on #109266 as it includes its commit to make this work.
@petrochenkov: It was exactly as you predicted, adding the
DefId
to the attributes fixed the error for intermediate re-exports as well. Thanks a lot!r? @petrochenkov