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

E0520 needs to be updated to new format #36112

Closed
sophiajt opened this issue Aug 29, 2016 · 4 comments
Closed

E0520 needs to be updated to new format #36112

sophiajt opened this issue Aug 29, 2016 · 4 comments

Comments

@sophiajt
Copy link
Contributor

sophiajt commented Aug 29, 2016

From: src/test/compile-fail/E0520.rs

E0520 needs a span_label, a span_note converted to a span_label, a note, and a new title, updating it from:

error[E0520]: item `fly` is provided by an `impl` that specializes another, but the item in the parent `impl` is not marked `default` and so it cannot be specialized.
  --> src/test/compile-fail/E0520.rs:26:5
   |
26 |     default fn fly(&self) {} //~ ERROR E0520
   |     ^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: parent implementation is here:
  --> src/test/compile-fail/E0520.rs:21:1
   |
21 | impl<T: Clone> SpaceLlama for T {
   | ^

To:

error[E0520]:  `fly` specializes an item from a parent impl, but neither that item nor the impl are marked default 
  --> src/test/compile-fail/E0520.rs:26:5
   |
21 | impl<T: Clone> SpaceLlama for T {
   | - parent `impl` is here
...
26 |     default fn fly(&self) {} //~ ERROR E0520
   |     ^^^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `fly`
   |
   = note: to specialize, either the parent `impl` or `fly` in the parent `impl` must be marked `default`
@nikomatsakis
Copy link
Contributor

nikomatsakis commented Aug 29, 2016

The new form of the message is not quite accurate. You can either default on the impl or the item -- putting it on the impl implies both that all items are specializable and also that the impl trait is not implemented (yet).

Maybe the message we want is more like one of these:

  • fly specializes a non-default item from a parent impl
  • fly specializes an item from a parent impl, but neither that item nor the impl are marked default
  • fly specializes an item from a parent impl, but that item is not specializable
    • then the note(s) can explain the details

@sophiajt sophiajt changed the title [WIP] E0520 needs to be updated to new format E0520 needs to be updated to new format Aug 29, 2016
@sophiajt
Copy link
Contributor Author

@nikomatsakis - I updated it based on your suggestions. Could probably stand another pass, but maybe good for now?

@nikomatsakis
Copy link
Contributor

@jonathandturner agreed good enough for now; I think I would maybe adopt something shorter in the header (like "not specializable") given that the note at the bottom spells out what that means

@nikomatsakis
Copy link
Contributor

but I could go either way

0xmohit added a commit to 0xmohit/rust that referenced this issue Aug 30, 2016
sophiajt pushed a commit to sophiajt/rust that referenced this issue Aug 30, 2016
sophiajt pushed a commit to sophiajt/rust that referenced this issue Aug 30, 2016
sophiajt pushed a commit to sophiajt/rust that referenced this issue Aug 31, 2016
sophiajt pushed a commit to sophiajt/rust that referenced this issue Aug 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants