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

implement `zip_binders` and add some `dyn Trait`/`impl Trait` tests #282

Merged

Conversation

@nikomatsakis
Copy link
Collaborator

nikomatsakis commented Nov 11, 2019

Fixes #275

r? @tmandry -- or somebody else?
cc @kennytm

cc @flodiebold -- I think this makes dyn Trait in chalk work?

@nikomatsakis nikomatsakis force-pushed the nikomatsakis:issue-275-unification-under-binders branch from 409dce3 to 93e2ca3 Nov 11, 2019
fn split(&self) -> (&[ParameterKind<()>], &Self::Output) {
(&self.binders, &self.value)
let p: fn(usize) -> ParameterKind<()> = make_lifetime;
((0..self.num_binders).map(p), &self.ty)

This comment has been minimized.

Copy link
@jackh726

jackh726 Nov 12, 2019

Contributor

Why not just (0..self.num_binders).map(make_lifetime)?

This comment has been minimized.

Copy link
@nikomatsakis

nikomatsakis Nov 12, 2019

Author Collaborator

Because you can't name the resulting type -- the type of make_lifetime is a unique ZST tied to that function, and it can't be typed. Really what I want here is impl Trait but that's not available in this context on stable.

@kennytm

This comment has been minimized.

Copy link
Member

kennytm commented Nov 12, 2019

I'm not sure what am I being pinged for 😕

@nikomatsakis

This comment has been minimized.

Copy link
Collaborator Author

nikomatsakis commented Nov 12, 2019

Oops, sorry @kennytm, I meant to ping @KiChjang

Copy link
Contributor

tmandry left a comment

LGTM after comments

tests/test/existential_types.rs Outdated Show resolved Hide resolved

goal {
forall<'static> {
dyn forall<'a> Foo<Ref<'a>> + Bar: Foo<Ref<'static>>

This comment has been minimized.

Copy link
@tmandry

tmandry Nov 13, 2019

Contributor

I'm guessing we can't write an impl version of this in chalk today

This comment has been minimized.

Copy link
@nikomatsakis

nikomatsakis Nov 14, 2019

Author Collaborator

I'm confused, why not?

tests/test/existential_types.rs Show resolved Hide resolved
tests/test/unify.rs Show resolved Hide resolved
chalk-solve/src/infer/unify.rs Outdated Show resolved Hide resolved
@nikomatsakis nikomatsakis force-pushed the nikomatsakis:issue-275-unification-under-binders branch from 0e32d60 to ac3d1e7 Nov 14, 2019
@nikomatsakis nikomatsakis merged commit d0a6b22 into rust-lang:master Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.