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

Trait selection treats unboxed closure arguments as quasi-associated types #20872

Closed
nikomatsakis opened this issue Jan 10, 2015 · 7 comments
Closed
Labels
A-closures Area: Closures (`|…| { … }`)

Comments

@nikomatsakis
Copy link
Contributor

Currently trait selection treats unboxed closure arg/ret types as quasi-associated types. It's weird and hard to explain. It should change. I don't expect much impact although error messages might get less good; we should consider working on that.

@nikomatsakis nikomatsakis added the A-closures Area: Closures (`|…| { … }`) label Jan 10, 2015
@aturon aturon mentioned this issue Jan 10, 2015
47 tasks
@nikomatsakis
Copy link
Contributor Author

prob makes sense to fix this together with #20871

@Nercury
Copy link
Contributor

Nercury commented Jan 10, 2015

Can this also be a reason for #20770 (closures behaving as if they were the same, no matter the argument differences)?

@nikomatsakis
Copy link
Contributor Author

@Nercury I think that this comment is an accurate summary of the problem there.

@Nercury
Copy link
Contributor

Nercury commented Jan 10, 2015

Ok, sorry, I am just completely lost :(

@dovahcrow
Copy link
Contributor

@nikomatsakis
will call on self error be solved by solving this issue?
e.g.

struct A;
impl Fn(isize,isize) for A {
  extern "rust-call" fn call(&self, args: (isize,isize)) {
    ....
  }
}
impl Fn(isize) for A {
  extern "rust-call" fn call(&self, args: (isize,)) {
    self(args.0, args.0) 
    // error: the type of this value must be known in this context
    // self(args.0 args.0)
    // error: cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit [E0059]
  }
}

but UFCS is usable:

impl Fn(isize) for A {
  extern "rust-call" fn call(&self, args: (isize,)) {
    Fn::<(isize,isize)>::call(self, (args.0,args.0))
  }
}

@arielb1
Copy link
Contributor

arielb1 commented Jul 7, 2015

I don't think this is relevant today.

@steveklabnik
Copy link
Member

Triage: Gonna trust @arielb1 and give this a close; feel free to re-open if this is wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-closures Area: Closures (`|…| { … }`)
Projects
None yet
Development

No branches or pull requests

5 participants