-
Notifications
You must be signed in to change notification settings - Fork 14k
Switch to EarlyBinder for explicit_item_bounds
#110556
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
Switch to EarlyBinder for explicit_item_bounds
#110556
Conversation
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
…icit_item_bounds usages; remove bound_explicit_item_bounds query
…lyBinder; use this to simplify some EarlyBinder noise around explicit_item_bounds calls
c7575e9 to
f8a95a7
Compare
compiler-errors
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
few more tiny comments, no really big problems
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the turbofish necessary here? Alternatively, you could do something like subst_identity().to_vec(), right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This maybe ties into a larger question (sorry for the long comment below):
Right now, EarlyBinder<T>::subst_identity has the bound T: TypeFoldable, so it's not actually available here. I was considering getting rid of the TypeFoldable bound but wasn't sure how important it is to how EarlyBinder should work -- i.e., right now you can only call subst_identity on things that you could also call subst on. (Maybe this property would come in handy in the future if doing larger refactorings?)
The lack of subst_identity is what motivated me to add subst_identity_iter_copied in this PR, as an identity version of subst_iter_copied.
Haha but now I'm worried that I'm overthinking and over-complicating this. If it's alright to do subst_identity on any inner type, then we don't have to add new methods on EarlyBinder in this PR, and every subst_identity_iter_copied would just become subst_identity().iter() (or in the case above, subst_identity().to_vec() as you mentioned). What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmmmmmm.. maybe we could implement subst_identity on anything that implements TypeVisitable? We probably don't need it to be TypeFoldable, but I could potentially see us using some folder to make sure that it's actually valid to subst identity?
f8a95a7 to
5a69b5d
Compare
|
Thanks for your comments! I amended the last commit to change those Please see my response to your other comment, I had a question relating to it 😅 |
compiler-errors
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine for now. Thanks!
|
@bors r+ |
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#110556 (Switch to `EarlyBinder` for `explicit_item_bounds`) - rust-lang#110615 (Add `impl_tag!` macro to implement `Tag` for tagged pointer easily) - rust-lang#110649 (Fix no_global_oom_handling build) - rust-lang#110671 (Consider polarity in new solver) - rust-lang#110783 (Fix ICE on --print=... i/o errors) - rust-lang#110796 (Updating Wake example to use new 'pin!' macro) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
…tem-bounds, r=compiler-errors Switch to `EarlyBinder` for `explicit_item_bounds` Part of the work to finish rust-lang#105779. This PR adds `EarlyBinder` to the return type of the `explicit_item_bounds` query and removes `bound_explicit_item_bounds`. r? `@compiler-errors` (hope it's okay to request you, since you reviewed rust-lang#110299 and rust-lang#110498 😃)
Part of the work to finish #105779.
This PR adds
EarlyBinderto the return type of theexplicit_item_boundsquery and removesbound_explicit_item_bounds.r? @compiler-errors (hope it's okay to request you, since you reviewed #110299 and #110498 😃)