Skip to content
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

Move binder for dyn to each list item #79945

Merged
merged 3 commits into from
Dec 17, 2020

Conversation

jackh726
Copy link
Member

This essentially changes ty::Binder<&'tcx List<ExistentialTraitRef>> to &'tcx List<ty::Binder<ExistentialTraitRef>>.

This is a first step in moving the dyn Trait representation closer to Chalk, which we've talked about in @rust-lang/wg-traits.

r? @nikomatsakis

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 11, 2020
@@ -87,7 +87,7 @@ pub struct CtxtInterners<'tcx> {
substs: InternedSet<'tcx, InternalSubsts<'tcx>>,
canonical_var_infos: InternedSet<'tcx, List<CanonicalVarInfo<'tcx>>>,
region: InternedSet<'tcx, RegionKind>,
existential_predicates: InternedSet<'tcx, List<ExistentialPredicate<'tcx>>>,
poly_existential_predicates: InternedSet<'tcx, List<ty::Binder<ExistentialPredicate<'tcx>>>>,
Copy link
Member Author

Choose a reason for hiding this comment

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

This name change probably isn't necessary, but I would like to hear thoughts.

Copy link
Contributor

Choose a reason for hiding this comment

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

seems fine

@@ -616,24 +616,28 @@ impl<'tcx> Relate<'tcx> for &'tcx ty::List<ty::ExistentialPredicate<'tcx>> {
// in `a`.
let mut a_v: Vec<_> = a.into_iter().collect();
let mut b_v: Vec<_> = b.into_iter().collect();
a_v.sort_by(|a, b| a.stable_cmp(tcx, b));
a_v.sort_by(|a, b| a.skip_binder().stable_cmp(tcx, &b.skip_binder()));
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems fine, but I think it works only because we are moving towards a "normalized" form where bound things are referenced purely by index, and this binder has exactly one bound item.

Copy link
Contributor

Choose a reason for hiding this comment

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

Might be worth adding a comment about this.

Copy link
Contributor

Choose a reason for hiding this comment

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

(In particular, if we had something like for<'a>... and for<'b>..., and the late-bound regions referenced them by name, those are equivalent, but they might be sorted differently.)

@nikomatsakis
Copy link
Contributor

r=me with comment

@nikomatsakis
Copy link
Contributor

@bors delegate+

@bors
Copy link
Contributor

bors commented Dec 12, 2020

✌️ @jackh726 can now approve this pull request

@jackh726
Copy link
Member Author

Alright, so the trivial explanation here is simply that stable_cmp doesn't take into account anything other than the type of predicates. In a perfect world, I would go into more depth about the scenarios in which it did, but this actually is a somewhat complicated issue (see Zulip discussion here), and it's not entirely clear that there could be multiple different bound vars here anyways.

Given that, @bors r=nikomatsakis

@bors
Copy link
Contributor

bors commented Dec 14, 2020

📌 Commit 01c2520 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 Dec 14, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Dec 15, 2020
…ikomatsakis

Move binder for dyn to each list item

This essentially changes `ty::Binder<&'tcx List<ExistentialTraitRef>>` to `&'tcx List<ty::Binder<ExistentialTraitRef>>`.

This is a first step in moving the `dyn Trait` representation closer to Chalk, which we've talked about in `@rust-lang/wg-traits.`

r? `@nikomatsakis`
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Dec 15, 2020
…ikomatsakis

Move binder for dyn to each list item

This essentially changes `ty::Binder<&'tcx List<ExistentialTraitRef>>` to `&'tcx List<ty::Binder<ExistentialTraitRef>>`.

This is a first step in moving the `dyn Trait` representation closer to Chalk, which we've talked about in ``@rust-lang/wg-traits.``

r? ``@nikomatsakis``
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Dec 15, 2020
…ikomatsakis

Move binder for dyn to each list item

This essentially changes `ty::Binder<&'tcx List<ExistentialTraitRef>>` to `&'tcx List<ty::Binder<ExistentialTraitRef>>`.

This is a first step in moving the `dyn Trait` representation closer to Chalk, which we've talked about in ```@rust-lang/wg-traits.```

r? ```@nikomatsakis```
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Dec 16, 2020
…ikomatsakis

Move binder for dyn to each list item

This essentially changes `ty::Binder<&'tcx List<ExistentialTraitRef>>` to `&'tcx List<ty::Binder<ExistentialTraitRef>>`.

This is a first step in moving the `dyn Trait` representation closer to Chalk, which we've talked about in ````@rust-lang/wg-traits.````

r? ````@nikomatsakis````
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Dec 16, 2020
…ikomatsakis

Move binder for dyn to each list item

This essentially changes `ty::Binder<&'tcx List<ExistentialTraitRef>>` to `&'tcx List<ty::Binder<ExistentialTraitRef>>`.

This is a first step in moving the `dyn Trait` representation closer to Chalk, which we've talked about in `````@rust-lang/wg-traits.`````

r? `````@nikomatsakis`````
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Dec 16, 2020
…ikomatsakis

Move binder for dyn to each list item

This essentially changes `ty::Binder<&'tcx List<ExistentialTraitRef>>` to `&'tcx List<ty::Binder<ExistentialTraitRef>>`.

This is a first step in moving the `dyn Trait` representation closer to Chalk, which we've talked about in ``````@rust-lang/wg-traits.``````

r? ``````@nikomatsakis``````
@jackh726
Copy link
Member Author

@bors r-

NLL test needs to be blessed (this is causing the rollups to fail)

@bors bors removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Dec 17, 2020
@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Dec 17, 2020
Comment on lines +7 to +12
error: higher-ranked subtype error
--> $DIR/issue-40000.rs:6:9
|
LL | foo(bar);
| ^^^

Copy link
Member Author

Choose a reason for hiding this comment

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

Not exactly sure why this particular error gets duplicated. But, this is a pretty unhelpful error anyways and other tests have similar duplication for it (sometimes multiple). So, any fix for this duplication should probably be part of a larger, unrelated fix.

@jackh726
Copy link
Member Author

Test has been blessed. As I said in comment above, this particular error, while duplicated, isn't helpful, is duplicated in other tests, and a fix is an orthogonal change.

@bors r=nikomatsakis

@bors
Copy link
Contributor

bors commented Dec 17, 2020

📌 Commit 2edd301 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 17, 2020
@bors
Copy link
Contributor

bors commented Dec 17, 2020

⌛ Testing commit 2edd301 with merge eb4fc71...

@bors
Copy link
Contributor

bors commented Dec 17, 2020

☀️ Test successful - checks-actions
Approved by: nikomatsakis
Pushing eb4fc71 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 17, 2020
@bors bors merged commit eb4fc71 into rust-lang:master Dec 17, 2020
@rustbot rustbot added this to the 1.50.0 milestone Dec 17, 2020
@jackh726 jackh726 deleted the existential_trait_ref branch December 17, 2020 21:14
flip1995 pushed a commit to flip1995/rust that referenced this pull request Dec 20, 2020
…omatsakis

Move binder for dyn to each list item

This essentially changes `ty::Binder<&'tcx List<ExistentialTraitRef>>` to `&'tcx List<ty::Binder<ExistentialTraitRef>>`.

This is a first step in moving the `dyn Trait` representation closer to Chalk, which we've talked about in `@rust-lang/wg-traits.`

r? `@nikomatsakis`
bjorn3 pushed a commit to bjorn3/rust that referenced this pull request Dec 27, 2020
…omatsakis

Move binder for dyn to each list item

This essentially changes `ty::Binder<&'tcx List<ExistentialTraitRef>>` to `&'tcx List<ty::Binder<ExistentialTraitRef>>`.

This is a first step in moving the `dyn Trait` representation closer to Chalk, which we've talked about in `@rust-lang/wg-traits.`

r? `@nikomatsakis`
JohnTitor added a commit to JohnTitor/rust-semverver that referenced this pull request Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants