Next steps for FnDef binder changes (instantiate most FnDef binders)#159403
Next steps for FnDef binder changes (instantiate most FnDef binders)#159403addiesh wants to merge 3 commits into
Conversation
|
Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @oli-obk (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
014b214 to
d780036
Compare
This comment has been minimized.
This comment has been minimized.
what happened during the rebase??? lemme rollback and try see what broke |
d780036 to
6e740ba
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
330681e to
83e428c
Compare
This comment has been minimized.
This comment has been minimized.
83e428c to
9fb9767
Compare
This comment has been minimized.
This comment has been minimized.
9fb9767 to
3920a9e
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
5373d53 to
f118249
Compare
This comment has been minimized.
This comment has been minimized.
f118249 to
6aeb29e
Compare
This comment has been minimized.
This comment has been minimized.
6aeb29e to
ac8e8e5
Compare
| TraitItemKind::Fn(_, _) => Ty::new_fn_def( | ||
| tcx, | ||
| def_id.to_def_id(), | ||
| ty::Binder::bind_with_vars( | ||
| ty::GenericArgs::identity_for_item(tcx, def_id), | ||
| tcx.late_bound_vars(item.hir_id()), | ||
| ), | ||
| ), |
There was a problem hiding this comment.
preexisting, but considering how duplicated this is across the various invocations, add a a closure above for creating such a fn def and just invoke it in each site.
| let args = ty::GenericArgs::identity_for_item(tcx, def_id); | ||
| // FIXME(156581): actually instantiate the binder correctly (turbofishing/fndef changes) | ||
| Ty::new_fn_def(tcx, ctor.to_def_id(), ty::Binder::dummy(args)) | ||
| let fn_sig = tcx.fn_sig(ctor.to_def_id()).instantiate_identity().skip_norm_wip(); |
There was a problem hiding this comment.
this is still going through fn_sig, take the late_bound_vars route here (and everywhere below), too
There was a problem hiding this comment.
you'll probably want to add a late_bound_vars_for_def_id that internally just invokes local_def_id_to_hir_id and then uses that HirId for late_bound_vars.
| Ok(a_ty) | ||
| } | ||
|
|
||
| fn relate_ty_args_bound( |
There was a problem hiding this comment.
how much is relate_ty_args used? Could we just have a single function, or if that's too verbose, implement relate_ty_args in the trait with a default impl that calls relate_ty_args_bound and remove all impl overrides of relate_ty_args?
| } | ||
|
|
||
| pub fn combine_ty_args_bound<Infcx, I, R>( | ||
| infcx: &Infcx, |
There was a problem hiding this comment.
same thing here, avoid this duplication, maybe just by implementing combine_ty_args in terms of combine_ty_args_bound, but ideally just by having bound vars on combine_ty_args and adjusting all the call sites (if it's not too many). If the latter is reasonably doable, then do it in a separate commit before all the other commits in this PR
|
Reminder, once the PR becomes ready for a review, use |
This comment has been minimized.
This comment has been minimized.
92a8cca to
bdb055e
Compare
This comment has been minimized.
This comment has been minimized.
bdb055e to
60bc61a
Compare
|
@rustbot ready :3 |
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Next steps for FnDef binder changes (instantiate most FnDef binders)
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (b2c0bf0): comparison URL. Overall result: ❌ regressions - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in writing along with @bors rollup=never rustc-perf Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 0.9%, secondary -4.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.3%, secondary 3.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.2%, secondary 0.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 487.415s -> 488.409s (0.20%) |
This comment has been minimized.
This comment has been minimized.
4b6280c to
1d38675
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
1d38675 to
a5f0deb
Compare
|
☔ The latest upstream changes (presumably #159942) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
View all comments
This change is a part of the ongoing effort to clean up binder/turbofishing behavior in the compiler (#156581).
This PR instantiates binders that were previously created via
ty::Binder::dummy()with meaningfully bound vars.r? oli-obk