-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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: Search shows incorrect paths for enum variants #17457
Comments
Is it really a bad thing ? |
I see no point in using the :: path syntax if the path isn't the real path of the identifier. I was searching for |
I imagine this was done originally because variants and types were in different namespaces. Now that they're in the same namespace rustdoc should use the real path as @mahkoh suggested. |
If accepted, rust-lang/rfcs#390 would close this (although some variants might also be re-exported at the same level as the enum). |
This can be closed now that #18481 is merged |
fix: ensure there are no cycles in the source_root_parent_map See rust-lang#17409 We can view the connections between roots as a graph. The problem is that this graph may contain cycles, so when adding edges, it is necessary to check whether it will lead to a cycle. Since we ensure that each node has at most one outgoing edge (because each SourceRoot can have only one parent), we can use a disjoint-set to maintain the connectivity between nodes. If an edge’s two nodes belong to the same set, they are already connected. Additionally, this PR includes the following three changes: 1. Removed the workaround from rust-lang#17409. 2. Added an optimization: If `map.contains_key(&SourceRootId(*root_id as u32))`, we can skip the current loop iteration since we have already found its parent. 3. Modified the inner loop to iterate in reverse order with `roots[..idx].iter().rev()` at line 319. This ensures that if we are looking for the parent of `a/b/c`, and both `a` and `a/b` meet the criteria, we will choose the longer match (`a/b`).
E.g. http://doc.rust-lang.org/syntax/ast/enum.Expr_.html?search=ExprIndex shows
syntax::ast::Expr_::ExprIndex
but the correct path issyntax::ast::ExprIndex
.The text was updated successfully, but these errors were encountered: