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

Self is not recognised as implementing kinds in default method implementations #8171

Closed
chris-morgan opened this issue Aug 1, 2013 · 2 comments

Comments

@chris-morgan
Copy link
Member

commented Aug 1, 2013

(This is related to #7661. It is in fact the second case there, but moved into a new issue as it languished there with the rest fixed.)

fn require_send<T: Send>(_: T){}

trait TragicallySelfIsNotSend: Send {
    fn x(self) {
        require_send(self);
    }
}

fn main(){}

This does not compile, though it should:

<anon>:5:8: 5:20 error: instantiating a type parameter with an incompatible type `Self`, which does not fulfill `Send`
<anon>:5         require_send(self);
                 ^~~~~~~~~~~~
error: aborting due to previous error

I need this to be able to refer to self inside a spawn closure, and that will only work if it's Send, and so there I sadly cannot provide a default method implementation of the trait at present.

(buzzwords for search: built-in trait inheritance.)

@Aatch

This comment has been minimized.

Copy link
Contributor

commented Aug 3, 2013

Nominating for a milestone, probably well-defined. We need some way of bounding the Self type inside default methods.

@catamorphism

This comment has been minimized.

Copy link
Contributor

commented Sep 12, 2013

We think this is fixed. Marked as needstest.

huonw added a commit to huonw/rust that referenced this issue Sep 16, 2013
bors added a commit that referenced this issue Sep 16, 2013
bors added a commit that referenced this issue Sep 17, 2013

@huonw huonw closed this in 4f92f45 Sep 17, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.