Skip to content

Commit

Permalink
Start using serde_derive in a couple places in the compiler.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Dec 2, 2018
1 parent 9abc231 commit 81ac104
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2223,6 +2223,7 @@ version = "0.0.0"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
]

Expand Down Expand Up @@ -2288,6 +2289,8 @@ dependencies = [
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_cratesio_shim 0.0.0",
"rustc_data_structures 0.0.0",
"serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)",
"serialize 0.0.0",
"syntax_pos 0.0.0",
"termcolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down Expand Up @@ -2901,6 +2904,8 @@ dependencies = [
"cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_data_structures 0.0.0",
"scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)",
"serialize 0.0.0",
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
Expand Down
1 change: 1 addition & 0 deletions src/librustc_cratesio_shim/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ crate-type = ["dylib"]
[dependencies]
bitflags = "1.0"
log = "0.4"
serde = "1.0"
unicode-width = "0.1.4"
1 change: 1 addition & 0 deletions src/librustc_cratesio_shim/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@
extern crate bitflags;
extern crate log;
extern crate proc_macro;
extern crate serde;
extern crate unicode_width;
2 changes: 2 additions & 0 deletions src/librustc_errors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ serialize = { path = "../libserialize" }
syntax_pos = { path = "../libsyntax_pos" }
rustc_data_structures = { path = "../librustc_data_structures" }
rustc_cratesio_shim = { path = "../librustc_cratesio_shim" }
serde = "1.0"
serde_derive = "1.0"
unicode-width = "0.1.4"
atty = "0.2"
termcolor = "1.0"
8 changes: 7 additions & 1 deletion src/librustc_errors/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ extern crate libc;
#[macro_use]
extern crate log;
extern crate rustc_data_structures;
#[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate serialize as rustc_serialize;
extern crate syntax_pos;
extern crate unicode_width;
Expand Down Expand Up @@ -66,7 +69,10 @@ use syntax_pos::{BytePos,
Span,
NO_EXPANSION};

#[derive(Copy, Clone, Debug, PartialEq, Hash, RustcEncodable, RustcDecodable)]
#[derive(Copy, Clone, Debug, PartialEq, Hash,
RustcDecodable, RustcEncodable,
Serialize, Deserialize,
)]
pub enum Applicability {
MachineApplicable,
HasPlaceholders,
Expand Down
2 changes: 2 additions & 0 deletions src/libsyntax_pos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ serialize = { path = "../libserialize" }
rustc_data_structures = { path = "../librustc_data_structures" }
arena = { path = "../libarena" }
scoped-tls = { version = "0.1.1", features = ["nightly"] }
serde = "1.0"
serde_derive = "1.0"
unicode-width = "0.1.4"
cfg-if = "0.1.2"
8 changes: 7 additions & 1 deletion src/libsyntax_pos/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ extern crate rustc_data_structures;

#[macro_use]
extern crate scoped_tls;
#[macro_use]
extern crate serde_derive;
extern crate serde;

use serialize::{Encodable, Decodable, Encoder, Decoder};

Expand Down Expand Up @@ -84,7 +87,10 @@ impl Globals {
scoped_thread_local!(pub static GLOBALS: Globals);

/// Differentiates between real files and common virtual files
#[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Hash, RustcDecodable, RustcEncodable)]
#[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Hash,
RustcDecodable, RustcEncodable,
Serialize, Deserialize,
)]
pub enum FileName {
Real(PathBuf),
/// A macro. This includes the full name of the macro, so that there are no clashes.
Expand Down
6 changes: 6 additions & 0 deletions src/tools/tidy/src/deps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ const WHITELIST: &[Crate] = &[
Crate("parking_lot_core"),
Crate("pkg-config"),
Crate("polonius-engine"),
Crate("proc-macro2"),
Crate("quick-error"),
Crate("quote"),
Crate("rand"),
Crate("rand_core"),
Crate("redox_syscall"),
Expand All @@ -121,15 +123,19 @@ const WHITELIST: &[Crate] = &[
Crate("rustc-rayon-core"),
Crate("scoped-tls"),
Crate("scopeguard"),
Crate("serde"),
Crate("serde_derive"),
Crate("smallvec"),
Crate("stable_deref_trait"),
Crate("syn"),
Crate("tempfile"),
Crate("termcolor"),
Crate("terminon"),
Crate("termion"),
Crate("thread_local"),
Crate("ucd-util"),
Crate("unicode-width"),
Crate("unicode-xid"),
Crate("unreachable"),
Crate("utf8-ranges"),
Crate("version_check"),
Expand Down

0 comments on commit 81ac104

Please sign in to comment.