-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Properly render HRTBs #84814
Properly render HRTBs #84814
Conversation
r? @jyn514 (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
8cacbea
to
31f9770
Compare
It looks like you already added a test? But could you also add a test case for HRTB in struct and enum definitions? For example: struct Foo<'b> {
pub my_fn: for<'a> fn(&'a u32) -> &'b u32,
}
// and something equivalent for enums EDIT: I forgot that a test already exists for this because I fixed this case in an earlier PR. |
@camelid are you interested in reviewing this? I have a lot of PRs assigned 😅 and I'm about to go on break for a few weeks. |
I will stop assigning you! Have fun! |
I need your opionion on this @camelid. The "best" solution I found, that is not just a dirty fix, would be to introduce a new |
Hmm, but how would that handle the case of bare functions like I tried looking in the Rust Reference to see what other places HRTBs can be used, but unfortunately it only seems to include information about uses in I also found another place where HRTBs can show up, though it probably is handled the same way as with struct Foo<T>
where
for<'a> T: PartialEq<&'a T>,
{
x: T,
}
struct Bar<T>
where
T: for<'a> PartialEq<&'a T>,
{
x: T,
} I would recommend asking on Zulip for help with figuring out where HRTBs can appear and how they should be handled. Hopefully some people more knowledgeable about the intricacies of HRTB can help you there :) |
These are both already handled. My current fix includes a new EDIT: I did not add a new |
r? @camelid |
c31cb05
to
d722c21
Compare
d722c21
to
3f9f7db
Compare
@camelid Sorry for the long delay here. My new commit introduces the new Might you be able to look at them and see if you can spot the mistake faster than me spending hours debbuing 😅 ? |
This comment has been minimized.
This comment has been minimized.
3f9f7db
to
f90d268
Compare
This comment has been minimized.
This comment has been minimized.
Could you post screenshots of what the generated pages look like for the parts of the tests that are failing? I probably won't be able to look at them for the next week or so, but I'll make sure to take a look after. |
f90d268
to
db8fd51
Compare
db8fd51
to
4ea2748
Compare
Ahh, I finally found it. This should be ready to merge now! r? @camelid |
Thanks! @bors: r+ |
📌 Commit 4ea2748 has been approved by |
☀️ Test successful - checks-actions |
This will now render properly including the
for<'a>
I do not know if this covers all cases, it only covers everything that I could think of that includes
for
and lifetimes in where bounds.Also someone need to mentor me on how to add a proper rustdoc test for this.
Resolves #78482