Skip to content
This repository was archived by the owner on Nov 24, 2023. It is now read-only.

replace serde_macros by serde_derive #20

Merged
merged 2 commits into from
Nov 7, 2016

Conversation

little-dude
Copy link
Contributor

serde_macros is being deprecated in favor of serde_derive[0].
As a result, rustfix does not build on nighlty anymore[1].
This commit replaces serde_macros by serde_derive.

[0]
https://users.rust-lang.org/t/serde-transitioning-to-macros-1-1/7437/5

[1] serde-rs/serde#606 (comment)

Unfortunately, this is not enough:

error[E0277]: the trait bound `rustfix::diagnostics::Diagnostic: serde::de::Deserialize` is not satisfied
  --> src/main.rs:78:26
   |
78 |         .flat_map(|line| serde_json::from_str::<Diagnostic>(line))
   |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `serde::de::Deserialize` is not implemented for `rustfix::diagnostics::Diagnostic`
   |
   = note: required by `serde_json::from_str`

I dont' get this error because rustfix::diagnostics::Diagnostic does derive Deserialize: https://github.com/killercup/rustfix/blob/master/src/diagnostics.rs#L5

Feel free to close in favor of a working PR, otherwise, I'll try to finish this tonight.

@killercup
Copy link
Member

Thanks! I think you only need minimal changes to make this work :)

You need to load serde_derive and enable the new macro feature. Reading https://serde.rs/codegen.html, I think you just need to replace the first few lines in lib.rs with this:

#![feature(proc_macro)]

#[macro_use]
extern crate serde_derive;

extern crate serde_json;

If you want to, you can also try to make this compile on stable Rust (as a different PR maybe).

By the way, can you also change the nightly's date to a more recent one in .travis.yml?

serde_macros is being deprecated in favor of serde_derive[0].
As a result, rustfix does not build on nighlty anymore[1].
This commit replaces serde_macros by serde_derive.

[0]
https://users.rust-lang.org/t/serde-transitioning-to-macros-1-1/7437/5

[1] serde-rs/serde#606 (comment)
@little-dude
Copy link
Contributor Author

Thank you for your help! It now builds on the latest nightly:

$ rustc --version
rustc 1.14.0-nightly (cae6ab1c4 2016-11-05)

@killercup killercup merged commit 29901f0 into rust-lang:master Nov 7, 2016
@killercup
Copy link
Member

Thanks again!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants