Skip to content

fix: reorder dyn bounds on render #13382

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

Merged
merged 1 commit into from
Oct 11, 2022

Conversation

lowr
Copy link
Contributor

@lowr lowr commented Oct 10, 2022

Fixes #13368

#13192 changed the order of dyn bounds, violating the contract with write_bounds_like_dyn_trait() on render. The projection bounds are expected to come right after the trait bound they are accompanied with.

Although the reordering procedure can be made a bit more efficient, I opted for relying only on the invariants currently documented in lower_dyn_trait(). It's not the hottest path and dyn bounds tend to be short so I believe it shouldn't hurt performance noticeably.

Copy link
Member

@lnicola lnicola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a FIXME to use https://doc.rust-lang.org/std/iter/trait.Iterator.html?search=vec#method.partition_in_place when it hits stable? If I'm reading this right, it would work here.

@lnicola
Copy link
Member

lnicola commented Oct 10, 2022

@bors delegate+

@bors
Copy link
Contributor

bors commented Oct 10, 2022

✌️ @lowr can now approve this pull request

@lowr lowr force-pushed the fix/reorder-dyn-bounds-on-render branch from 85dca06 to 5e43ea9 Compare October 11, 2022 11:26
@lowr
Copy link
Contributor Author

lowr commented Oct 11, 2022

Yeah, I really wanted to use Iterator::partition_in_place() or Vec::drain_filter() only to find they are both unstable... I've put a FIXME note as suggested.

@bors r+

@bors
Copy link
Contributor

bors commented Oct 11, 2022

📌 Commit 5e43ea9 has been approved by lowr

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Oct 11, 2022

⌛ Testing commit 5e43ea9 with merge d08f1c3...

@bors
Copy link
Contributor

bors commented Oct 11, 2022

☀️ Test successful - checks-actions
Approved by: lowr
Pushing d08f1c3 to master...

@bors bors merged commit d08f1c3 into rust-lang:master Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Send and Future swapped in type hints
3 participants