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
Labels
A-trait-system Area: Trait system E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@chris-morgan
Copy link
Member

(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
Copy link
Contributor

Aatch commented Aug 3, 2013

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

@catamorphism
Copy link
Contributor

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 as completed in 4f92f45 Sep 17, 2013
flip1995 pushed a commit to flip1995/rust that referenced this issue Dec 30, 2021
cache test item names

This avoids quadratic behavior (collecting all test item names for each `eq_op` instance within the module). However, it invests a good deal of memory to buy this speedup. If that becomes a problem, I may need to change the cache to only store the chain of last visited modules.

This hopefully fixes rust-lang#8171.

---

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-trait-system Area: Trait system E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants