Skip to content

Followup to #83944 #84377

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 7 commits into from
Apr 22, 2021
Merged

Followup to #83944 #84377

merged 7 commits into from
Apr 22, 2021

Conversation

jackh726
Copy link
Member

Some cleanups requested by @nikomatsakis

r? @nikomatsakis

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 20, 2021
@jackh726 jackh726 added the WG-traits Working group: Traits, https://internals.rust-lang.org/t/announcing-traits-working-group/6804 label Apr 20, 2021
Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

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

Seems like this might make things simpler. Thoughts?

Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

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

This is looking good. Left a few comments.

hir::GenericBound::LangItemTrait(_, _, hir_id, _) if self.trait_ref_hack.is_none() => {
self.map.late_bound_vars.insert(*hir_id, vec![]);
hir::GenericBound::LangItemTrait(_, _, hir_id, _) => {
self.map.late_bound_vars.insert(*hir_id, binders);
Copy link
Contributor

Choose a reason for hiding this comment

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

Except that I don't quite get why we need any code here at all. It seems like the LangItemTrait is basically a "poly trait ref" that binds no variables at all. We could probably pull out a helper from visit_poly_trait_ref that does the exact same setup code -- which would be good -- or else delete this code altogether, because it's not really needed. I can't quite see any case where introducing a Binder here changes behavior.

I guess the only change could be that there is a PolyTraitRef boundary (with no variables) instead of a TraitRefBoundary binder. Are those equivalent? I would think so (does that suggest a further simplification is possible?).

@@ -618,6 +567,43 @@ fn late_region_as_bound_region<'tcx>(tcx: TyCtxt<'tcx>, region: &Region) -> ty::
}
}

impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
/// Returns the binders in scope and the type of `Binder` that should be created for a poly trait ref.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe link to the Concatenating variant for more comments

@nikomatsakis
Copy link
Contributor

this looks great.

@bors r+

@bors
Copy link
Collaborator

bors commented Apr 21, 2021

📌 Commit c78724f has been approved by nikomatsakis

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 21, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Apr 22, 2021
…omatsakis

Followup to rust-lang#83944

Some cleanups requested by `@nikomatsakis`

r? `@nikomatsakis`
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 22, 2021
Rollup of 7 pull requests

Successful merges:

 - rust-lang#84343 (Remove `ScopeTree::closure_tree`)
 - rust-lang#84376 (Uses flex to fix formatting of h1 at any width)
 - rust-lang#84377 (Followup to rust-lang#83944)
 - rust-lang#84396 (Update LLVM submodule)
 - rust-lang#84402 (Move `sys_common::rwlock::StaticRWLock` etc. to `sys::unix::rwlock`)
 - rust-lang#84404 (Check for intrinsics before coercing to a function pointer)
 - rust-lang#84413 (Remove `sys::args::Args::inner_debug` and use `Debug` instead)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 9b432e0 into rust-lang:master Apr 22, 2021
@rustbot rustbot added this to the 1.53.0 milestone Apr 22, 2021
@jackh726 jackh726 deleted the binder-refactor-fix branch March 12, 2022 18:06
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. WG-traits Working group: Traits, https://internals.rust-lang.org/t/announcing-traits-working-group/6804
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants