-
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
switch to EarlyBinder
as default
#105779
Comments
@rustbot claim |
Hi @lcnr, I was able to check this out a bit and I think I understand what needs to be done here. Just to be sure: the queries that we want to change correspond to all of the I played around with this a bit on the For some of the queries (namely |
Yes that sounds correct to me. There are quite a bit of places where we currently implicitly When accessing parts of the return type of these queries which don't access generic parameters, e.g. the number of arguments or c-variadic for rust/compiler/rustc_hir_typeck/src/expr.rs Line 546 in 7f42e58
|
Ok great, thanks for all the tips! I'll work on this and let you know if I get confused. |
Hi, I’ve been playing with this and have been able to implement the changes to the queries for some of the most used ones ( I want to clean some things up and then open a PR, but I have a few questions:
Sorry in advance for so many questions 😅. If this general plan sounds alright, I'll open a PR. Thanks! |
sorry for not replying earlier. I have been on vacation. 1.i. mostly correct. This may not help too much, but 1.ii. yes, as
Thanks for working on this ❤️ it feels difficult to explain 1. so I hope that it made at least some sense. Feel free to reach out about that on zulip if you have any questions. Explaining it in sync is easier 😁 |
Thanks so much for the detailed response! This helps a lot, I really appreciate it. (And sorry to have asked so many questions right before/during the holidays...:sweat_smile:). I should have some time this week to work on this :+1: |
This has been implemented for |
…ackh726 Document `EarlyBinder::subst_identity` and `skip_binder` Finishing implementing rust-lang#105779 will change several commonly used queries to return `EarlyBinder` by default. This PR adds documentation for two of the methods used to access data inside the `EarlyBinder`. I tried to summarize some of the [discussion from the issue](rust-lang#105779 (comment)) in writing this. r? `@lcnr`
…s, r=lcnr Switch to `EarlyBinder` for `item_bounds` query Part of the work to finish rust-lang#105779 (also see rust-lang/types-team#78). Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This adds `EarlyBinder` to the return type of the `item_bounds` query and removes `bound_item_bounds`. r? `@lcnr`
Switch to `EarlyBinder` for `fn_sig` query Part of the work to finish rust-lang#105779 (also see rust-lang/types-team#78). Several queries `X` have a `bound_X` variant that wraps the output in [`EarlyBinder`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/subst/struct.EarlyBinder.html). This adds `EarlyBinder` to the return type of the `fn_sig` query and removes `bound_fn_sig`. r? `@lcnr`
Switch to `EarlyBinder` for `fn_sig` query Part of the work to finish rust-lang#105779 (also see rust-lang/types-team#78). Several queries `X` have a `bound_X` variant that wraps the output in [`EarlyBinder`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/subst/struct.EarlyBinder.html). This adds `EarlyBinder` to the return type of the `fn_sig` query and removes `bound_fn_sig`. r? `@lcnr`
Switch to `EarlyBinder` for `type_of` query Part of the work to finish rust-lang#105779 and implement rust-lang/types-team#78. Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This adds `EarlyBinder` to the return type of the `type_of` query and removes `bound_type_of`. r? `@lcnr`
Switch to `EarlyBinder` for `type_of` query Part of the work to finish rust-lang#105779 and implement rust-lang/types-team#78. Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This adds `EarlyBinder` to the return type of the `type_of` query and removes `bound_type_of`. r? `@lcnr`
Switch to `EarlyBinder` for `type_of` query Part of the work to finish rust-lang#105779 and implement rust-lang/types-team#78. Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This adds `EarlyBinder` to the return type of the `type_of` query and removes `bound_type_of`. r? `@lcnr`
@kylematsuda are you still working on this? going to unassign you but definitely don't hesitate to reassign yourself if you intend to continue working on it. Thanks a lot for your good work here ❤️ |
Ah sorry @lcnr! I got a bit busy and dropped the ball on this... but I should have time to work on it more now. Thanks for the reminder 😅 Looking in the nightly docs, here are the
Also I think at some point @BoxyUwU had suggested changing I have some questions about a few of these but I might just try and knock out the more straightforward-looking ones first. @rustbot claim |
…ct, r=compiler-errors Switch to `EarlyBinder` for `impl_subject` query Part of the work to finish rust-lang#105779. Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This adds `EarlyBinder` to the return type of the `impl_subject` query and removes `bound_impl_subject`. r? `@lcnr`
…ct, r=compiler-errors Switch to `EarlyBinder` for `impl_subject` query Part of the work to finish rust-lang#105779. Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This adds `EarlyBinder` to the return type of the `impl_subject` query and removes `bound_impl_subject`. r? ``@lcnr``
…ct, r=compiler-errors Switch to `EarlyBinder` for `impl_subject` query Part of the work to finish rust-lang#105779. Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This adds `EarlyBinder` to the return type of the `impl_subject` query and removes `bound_impl_subject`. r? ```@lcnr```
…, r=compiler-errors Switch to `EarlyBinder` for `collect_return_position_impl_trait_in_trait_tys` Part of the work to finish rust-lang#105779. This PR adds `EarlyBinder` to the return type of the `collect_return_position_impl_trait_in_trait_tys` query and removes `bound_return_position_impl_trait_in_trait_tys`. r? `@lcnr`
…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 😃)
…s, r=compiler-errors Switch to `EarlyBinder` for `explicit_item_bounds` Part of the work to finish rust-lang/rust#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 #110299 and #110498 😃)
… r=BoxyUwU Make `(try_)subst_and_normalize_erasing_regions` take `EarlyBinder` Changes `subst_and_normalize_erasing_regions` and `try_subst_and_normalize_erasing_regions` to take `EarlyBinder<T>` instead of `T`. (related to rust-lang#105779) This was suggested by `@BoxyUwU` in rust-lang#107753 (comment). After changing `type_of` to return `EarlyBinder`, there were several places where the binder was immediately skipped to call `tcx.subst_and_normalize_erasing_regions`, only for the binder to be reconstructed inside of that method. r? `@BoxyUwU`
…onst, r=BoxyUwU Switch to `EarlyBinder` for `thir_abstract_const` query Part of the work to finish rust-lang#105779. This PR adds `EarlyBinder` to the return type of the `thir_abstract_const` query and removes `bound_abstract_const`. r? `@compiler-errors`
After merging #111410, all of the existing There is a bit of follow-up work that can be done (I'm happy to work on some of these if it would be helpful):
|
for clippy I am not sure how helpful opening an issue like "hey, some of the Further bubbling up I think it would also be valuable to try to make the value in |
…ackh726 Make `EarlyBinder`'s inner value private Currently, `EarlyBinder(T)`'s inner value is public, which allows implicitly skipping the binder by indexing into the tuple struct (i.e., `x.0`). `@lcnr` suggested making `EarlyBinder`'s inner value private so users are required to explicitly call `skip_binder` (rust-lang#105779 (comment)) . This PR makes the inner value private, adds `EarlyBinder::new` for constructing a new instance, and replaces uses of `x.0` with `x.skip_binder()` (or similar). It also adds some documentation to `EarlyBinder::skip_binder` explaining how to skip the binder of `&EarlyBinder<T>` to get `&T` now that the inner value is private (since previously we could just do `&x.0`). r? `@lcnr`
implement rust-lang/types-team#78
The text was updated successfully, but these errors were encountered: