-
Notifications
You must be signed in to change notification settings - Fork 13.4k
deriving error should point to field which caused the error #7724
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
I ran into another case of this error a few days ago. It went something like this:
Maybe this is just a missing Clone impl for raw pointers. Or perhaps this pattern is specifically not supported. I didn't have time to look but figured I'd update this bug. |
This is going to be hard, I think. But, maybe not. Perhaps the deriving could rewrite the span to the originating field? cc @huonw |
It shouldn't be too hard; I'll look at it tonight. |
(I have looked at it, I've got a patch compiling, but it'll take me a day or two to polish it off... I did it properly and started moving |
See #10355. Unfortunately the only implementation that's possible right now means that the error doesn't mention the |
This rearranges the deriving code so that #[deriving] a trait on a field that doesn't implement that trait will point to the field in question, e.g. struct NotEq; // doesn't implement Eq #[deriving(Eq)] struct Foo { ok: int, also_ok: ~str, bad: NotEq // error points here. } Unfortunately, this means the error is disconnected from the `deriving` itself but there's no current way to pass that information through to rustc except via the spans, at the moment. Fixes #7724.
…arth Add `std_instead_of_core`, `std_instead_of_alloc`, `alloc_instead_of_core` Closes rust-lang#7724 Introduces 3 new lints: - `std_instead_of_core` - lints items resolved through `std` which are available in `core` - `std_instead_of_alloc` - lints items resolved through `std` which are available in `alloc` - `alloc_instead_of_core` - lints items resolved through `alloc` which are available in `core` Though the original issue only mentions `std_instead_of_alloc`, the other two lints could be useful as well. questions: - what do I call the file the lints live in? I was thinking `std_reexports`? changelog: new lint's: [`std_instead_of_core`], [`std_instead_of_alloc`], [`alloc_instead_of_core`]
Compiling the following:
produces
The real error is that
Foo
doesn't implementClone
. The span should also probably point toFoo
in the definition forBar
instead of to the deriving line.The text was updated successfully, but these errors were encountered: