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

E0205 needs to be updated to new format #35382

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

E0205 needs to be updated to new format #35382

sophiajt opened this issue Aug 5, 2016 · 4 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints 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

@sophiajt
Copy link
Contributor

sophiajt commented Aug 5, 2016

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

Error E0205 needs a span label and updated title, changing it from:

error[E0205]: the trait `Copy` may not be implemented for this type; variant `Bar` does not implement `Copy`
  --> src/test/compile-fail/E0205.rs:18:10
   |
18 | #[derive(Copy)] //~ ERROR E0205
   |          ^^^^
src/test/compile-fail/E0205.rs:18:10: 18:14 note: in this expansion of #[derive(Copy)] (defined in src/test/compile-fail/E0205.rs)

error[E0205]: the trait `Copy` may not be implemented for this type; variant `Bar` does not implement `Copy`
  --> src/test/compile-fail/E0205.rs:16:1
   |
16 | impl Copy for Foo { } //~ ERROR E0205
   | ^^^^^^^^^^^^^^^^^^^^^

to:

error[E0205]: the trait `Copy` may not be implemented for this type
  --> src/test/compile-fail/E0205.rs:18:10
   |
18 | #[derive(Copy)] //~ ERROR E0205
   |          ^^^^ variant `Bar` does not implement `Copy`
src/test/compile-fail/E0205.rs:18:10: 18:14 note: in this expansion of #[derive(Copy)] (defined in src/test/compile-fail/E0205.rs)

error[E0205]: the trait `Copy` may not be implemented for this type
  --> src/test/compile-fail/E0205.rs:16:1
   |
16 | impl Copy for Foo { } //~ ERROR E0205
   | ^^^^^^^^^^^^^^^^^^^^^ variant `Bar` does not implement `Copy`

Bonus: the span for the second one could be shrunk to just the Copy part:

error[E0205]: the trait `Copy` may not be implemented for this type
  --> src/test/compile-fail/E0205.rs:18:10
   |
18 | #[derive(Copy)] //~ ERROR E0205
   |          ^^^^ variant `Bar` does not implement `Copy`
src/test/compile-fail/E0205.rs:18:10: 18:14 note: in this expansion of #[derive(Copy)] (defined in src/test/compile-fail/E0205.rs)

error[E0205]: the trait `Copy` may not be implemented for this type
  --> src/test/compile-fail/E0205.rs:16:1
   |
16 | impl Copy for Foo { } //~ ERROR E0205
   |      ^^^^ variant `Bar` does not implement `Copy`

Note: I'm not sure the "expansion of..." part is helpful, you could also remove that.

Seems related to #35381

@sophiajt sophiajt added A-diagnostics Area: Messages for errors, warnings, and lints 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. labels Aug 5, 2016
sophiajt pushed a commit to sophiajt/rust that referenced this issue Aug 7, 2016
@KiChjang
Copy link
Member

KiChjang commented Aug 8, 2016

@munyari Are you still working on the bonus part for this issue? Otherwise I can take over.

@munyari
Copy link
Contributor

munyari commented Aug 8, 2016

Feel free to take them both @KiChjang

@KiChjang
Copy link
Member

KiChjang commented Aug 8, 2016

I'm not quite in favour of removing the "in the expansion of" note. This is produced in librustc_errors/emitter.rs, and it is called when there is an error in macro invocation. #[derive(Copy)] is a special case, since the attribute expands into a macro. I'm not too keen on adding additional logic in emitter.rs just to handle this special case. Compiler plugins may also use macro invocations in attributes, so it's best to leave it alone.

@sophiajt
Copy link
Contributor Author

sophiajt commented Aug 8, 2016

@KiChjang - +1 on not making it special logic. There's a separate thread on improving macro errors. This should let us fix them more completely.

sophiajt pushed a commit to sophiajt/rust that referenced this issue Aug 8, 2016
Shrink E0205 span label to the trait being implemented

Part of rust-lang#35233.
Extension of rust-lang#35468.
Closes rust-lang#35382.

r? @GuillaumeGomez
steveklabnik added a commit to steveklabnik/rust that referenced this issue Aug 10, 2016
Shrink E0205 span label to the trait being implemented

Part of rust-lang#35233.
Extension of rust-lang#35468.
Closes rust-lang#35382.

r? @GuillaumeGomez
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 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