-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsregression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Description
I tried to derive every possible trait on an enum and received this error:
enum-derive.rs:3:1: 3:112 note: in this expansion of #[derive] (defined in enum-derive.rs)
enum-derive.rs:3:1: 3:112 error: this unsafe trait should be implemented explicitly
enum-derive.rs:3 #[derive(PartialEq, PartialOrd, Clone, Copy, Hash, RustcEncodable, RustcDecodable, Eq, Ord, Debug, Send, Sync)]
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
which isn't as helpful as it could be because it doesn't tell me which of the traits is the one it's complaining about.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsregression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
durka commentedon May 12, 2016
We just need to split this function into two (so it knows whether it's
Send
orSync
) and change the message. Also, shouldn't it have printed two errors?durka commentedon May 12, 2016
This is actually a regression. Playpen. On stable and beta the error spans point to the trait names, but on nightly (
RUST_NEW_ERROR_FORMAT
or not) they point to the whole attribute. cc #33240 @nikomatsakis @jonathandturnernikomatsakis commentedon May 12, 2016
Hmm. This is definitely a regression, but I'm not sure whether it's necessarily related to the new error messages (I can't think how that change would have caused this). I wonder if there were any changes to the deriving code tweaking the spans that it is using? Have to dig into it.
sophiajt commentedon May 19, 2016
Using a nightly before the new error format landed gives me this:
So it's likely a change between the beta and the nightly before we added the new errors.
nikomatsakis commentedon May 19, 2016
cc @LeoTestard could this have been caused by your changes related to stability? I suppose it might have been caused my PR for pattern matching, thought I don't think I changed any spans there.
LeoTestard commentedon May 20, 2016
@nikomatsakis Hmm, possible. I'll look at it more deeply.
LeoTestard commentedon May 20, 2016
Indeed it looks like it's caused by the fact that #[derive_*] attributes are now emitted with a special span so that the expansion functions for them knows if they have been generated by the expansion of a trusted attribute or if they have been written explicitly by the programmer (which is forbidden). I see three possiblities to fix that now:
#[derive]
works to stop producing intermediate attributes and remove those span hacks. I think that's what @nrc said he wants, eventually.#[derive_*]
attributes #33926Rollup merge of rust-lang#33926 - jseyfried:fix_derive_span, r=nrc