-
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: Render HRTB correctly for bare functions #79991
Conversation
This is invalid syntax:
Is it simple to display |
Yes, I was planning on opening a follow-up PR; I figured we should do it in two stages so the rendered syntax is at least plausible. I can do it in this PR instead if you think that's better though. |
Yes, I think it would be better to fix it here if possible. |
I fixed it for bare functions, but I think it will be harder to fix for |
Ok, that seems reasonable. The new output for traits is at least vaguely right so this is definitely a step in the right direction 😆 |
cf5a620
to
c82b548
Compare
This comment has been minimized.
This comment has been minimized.
This PR is blocked on me figuring out why the These are the htmldocck errors: #79991 (comment) |
Can you provide the full diff provided by the |
aebf392
to
9c31372
Compare
Rebased. |
This comment has been minimized.
This comment has been minimized.
I fixed the test! It was a silly mistake on my part: There were two issues:
The first one was the primary issue, though, because I couldn't Glad I was able to figure it out! |
Should be ready for review! (Let me know before you |
Looks good to me. Just waiting for @jyn514 now. ;) |
☔ The latest upstream changes (presumably #80987) made this pull request unmergeable. Please resolve the merge conflicts. |
I'm going to squash before I rebase since the conflicts are non-trivial (and it |
b58c71b
to
8a389b2
Compare
8a389b2
to
65a7ac0
Compare
Rebased! @GuillaumeGomez Given that Joshua is taking a break for a bit, do you want to be |
The angle brackets were not rendered, so code like this: some_func: for<'a> fn(val: &'a i32) -> i32 would be rendered as: some_func: fn'a(val: &'a i32) -> i32 However, rendering with angle brackets is still invalid syntax: some_func: fn<'a>(val: &'a i32) -> i32 so now it renders correctly as: some_func: for<'a> fn(val: &'a i32) -> i32 ----- However, note that this code: some_trait: dyn for<'a> Trait<'a> will still render as: some_trait: dyn Trait<'a> which is not invalid syntax, but is still unclear. Unfortunately I think it's hard to fix that case because there isn't enough information in the `rustdoc::clean::Type` that this code operates on. Perhaps that case can be fixed in a later PR.
65a7ac0
to
cd8dcee
Compare
Looks good to me, thanks! @bors: r=GuillaumeGomez,jyn514 |
📌 Commit cd8dcee has been approved by |
…llaumeGomez,jyn514 rustdoc: Render HRTB correctly for bare functions The angle brackets were not rendered, so code like this: some_func: for<'a> fn(val: &'a i32) -> i32 would be rendered as: some_func: fn'a(val: &'a i32) -> i32 However, rendering with angle brackets is still invalid syntax: some_func: fn<'a>(val: &'a i32) -> i32 so now it renders correctly as: some_func: for<'a> fn(val: &'a i32) -> i32 ----- However, note that this code: some_trait: dyn for<'a> Trait<'a> will still render as: some_trait: dyn Trait<'a> which is not invalid syntax, but is still unclear. Unfortunately I think it's hard to fix that case because there isn't enough information in the `rustdoc::clean::Type` that this code operates on. Perhaps that case can be fixed in a later PR. r? `@jyn514`
Rollup of 10 pull requests Successful merges: - rust-lang#79570 (rustc: Stabilize `-Zrun-dsymutil` as `-Csplit-debuginfo`) - rust-lang#79819 (Add `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` lint) - rust-lang#79991 (rustdoc: Render HRTB correctly for bare functions) - rust-lang#80215 (Use -target when linking binaries for Mac Catalyst) - rust-lang#81158 (Point to span of upvar making closure FnMut) - rust-lang#81176 (Improve safety of `LateContext::qpath_res`) - rust-lang#81287 (Split rustdoc JSON types into separately versioned crate) - rust-lang#81306 (Fuse inner iterator in FlattenCompat and improve related tests) - rust-lang#81333 (clean up some const error reporting around promoteds) - rust-lang#81459 (Fix rustdoc text selection for page titles) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
@hi-rustin there are some instructions in #78482. Please try to keep discussion in one place, this PR is not super relevant to 78482. |
The angle brackets were not rendered, so code like this:
would be rendered as:
However, rendering with angle brackets is still invalid syntax:
so now it renders correctly as:
However, note that this code:
will still render as:
which is not invalid syntax, but is still unclear. Unfortunately I think
it's hard to fix that case because there isn't enough information in the
rustdoc::clean::Type
that this code operates on. Perhaps that case canbe fixed in a later PR.
r? @jyn514