-
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: Re-exported impls render all bounds as where
clauses, regardless of source appearance
#89180
Comments
Re-exported types/traits are weird in general (eg. #84579). Is there a reason why re-exported types/trait/impls are rendered differently? |
Not to my knowledge. I think it's just that re-exports have a different code path, so the two paths can get out of sync. In most if not all cases, it's just subtle bugs in rustdoc :) |
where
clauses, regardless of source appearancewhere
clauses, regardless of source appearance
Disclaimer: I might've gotten some details wrong. When rustdoc documents the "current" crate (i.e. the root crate of "the dependency graph" (in the conceptual sense, not in the Cargo sense)), it has access to the HIR which is close to the AST allowing the rendered output to quite faithfully mirror the user-written code. For re-exported items, rustdoc has to take a look at the metadata files ( In my current understanding it is outright impossible to tell the "origin" / "source correspondence" of most of these pieces of information as data gets lost step by step during various desugaring and elaboration routines. The most obvious and naïve way to remedy this of course would be to add flags to This is hard. |
Rethinking this, I think there might be a way to fix this fully without much effort, although it's probably detrimental to performance. I haven't tried this out yet but this recently popped into my head: All clauses returned by I don't think Edit: As an update, Originally I assumed that the predicate span spanned the entire predicate (e.g., |
There is a "bug" related to cross-crate re-exports and
where
clauses: In thecore
docs, the impl looks like this (which is how it's actually written in the source):But in the
std
docs, the impl looks like this, with all of the bounds expressed aswhere
clauses:I think the re-exported version is actually better, because it's easier to read, but they should at least be consistent.
Originally posted by @camelid in #88809 (comment)
Note: It's possible this is triggered by any re-exports, not just cross-crate ones, but I haven't checked.
The text was updated successfully, but these errors were encountered: