Skip to content

specialisation error 502 is misleading #36553

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

Closed
nrc opened this issue Sep 17, 2016 · 5 comments
Closed

specialisation error 502 is misleading #36553

nrc opened this issue Sep 17, 2016 · 5 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-specialization Area: Trait impl specialization E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

Comments

@nrc
Copy link
Member

nrc commented Sep 17, 2016

error[E0520]: `Foo` specializes an item from a parent `impl`, but neither that item nor the `impl` are marked `default`

Because the impl itself cannot be marked default, only the individual item.

@nrc nrc added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. A-diagnostics Area: Messages for errors, warnings, and lints E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. A-specialization Area: Trait impl specialization labels Sep 17, 2016
@giannicic
Copy link
Contributor

Hi, I'm very new to rust and I'm trying to learn more about this language.
I would like to make the change. Seems that I have to change the error text (e.g. ..., but the item of the parent impl is not marked default), Is it right?
However searching about specialization documents I found this issue rust/issues/31844 where seems that a default implwill be possible.
Am i missing something?

@nrc
Copy link
Member Author

nrc commented Sep 20, 2016

The text should suggest that the item could be default, but not that the parent impl could be, because it can't. It might be in the future (as suggested by #31844) but that is not certain.

giannicic added a commit to giannicic/rust that referenced this issue Sep 22, 2016
this commit correct E0502 error text.
See referenced issue for further info
giannicic added a commit to giannicic/rust that referenced this issue Sep 26, 2016
@giannicic
Copy link
Contributor

Hi @nrc ,
I'm seeing a bit more deep the specialization feature. I'm wondering if I can try to implement the default impl.
I have in mind to do what is described in the following quotes taken from the RFC

we could easily add a shorthand later on in which default impl Trait for Type is sugar for adding default to all items in the impl.

For the moment, with this implementation, the default impl must define all items of the trait (not a part of them) and, therefore, they will be all treated as default items.
Would you accept a PR for this?

@nrc
Copy link
Member Author

nrc commented Oct 2, 2016

@giannicic there is some debate at the moment about some of the details of specialisation. It would probably be best to open a thread on internals.rust-lang.org before starting to work on this.

@kyrias
Copy link
Contributor

kyrias commented Oct 18, 2016

PR #36652 was merged, so this can be closed now.

@nrc nrc closed this as completed Oct 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-specialization Area: Trait impl specialization E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
Projects
None yet
Development

No branches or pull requests

3 participants