Skip to content

Commit 2390276

Browse files
committed
Auto merge of #56323 - eddyb:que-seri-sera, r=<try>
[WIP] serialize: rename to rustc_serialize. In preparation for post-#49219 use of custom derives in rustc, we'll want to stop using `Rustc{Encodable,Decodable}` derives, and *at least* adapt the library to suit `rustc` better, before a full implementation of #36588 can be done. This will break anyone using `extern crate serialize;` (on nightly) so let's do a crater run with a rename, just to see what things are like. **EDIT**: I was going to test with `rustc_serialize` (which does work in terms of compiling) but I realized that `rustc-serialize` from crates.io might make that tricky if it ends up in our sysroot, so for the crater run let's go with something weirder (`rustc_ezilaires`). **EDIT2**: had to remove `rustc_save_analysis` and `rls` to get rid of the crates.io `rustc-serialize` from Cargo.lock. Note that this is just for crater, just like the `rustc_ezilaires` rename. r? @nikomatsakis
2 parents b68fc18 + 2325917 commit 2390276

File tree

102 files changed

+205
-4716
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+205
-4716
lines changed

Cargo.lock

+18-311
Large diffs are not rendered by default.

Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@ members = [
1919
"src/tools/rust-installer",
2020
"src/tools/cargo",
2121
"src/tools/rustdoc",
22-
"src/tools/rls",
2322
"src/tools/rustfmt",
2423
"src/tools/miri",
2524
"src/tools/rustdoc-themes",
2625
]
2726
exclude = [
28-
"src/tools/rls/test_data",
27+
"src/tools/rls",
2928
"build",
3029
# HACK(eddyb) This hardcodes the fact that our CI uses `/checkout/obj`.
3130
"obj",

src/librustc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ rustc_apfloat = { path = "../librustc_apfloat" }
2525
rustc_target = { path = "../librustc_target" }
2626
rustc_data_structures = { path = "../librustc_data_structures" }
2727
rustc_errors = { path = "../librustc_errors" }
28-
serialize = { path = "../libserialize" }
28+
rustc_ezilaires = { path = "../librustc_ezilaires" }
2929
syntax = { path = "../libsyntax" }
3030
syntax_pos = { path = "../libsyntax_pos" }
3131
backtrace = "0.3.3"

src/librustc/hir/def_id.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use ty;
1212
use hir::map::definitions::FIRST_FREE_HIGH_DEF_INDEX;
1313
use rustc_data_structures::indexed_vec::Idx;
14-
use serialize;
14+
use rustc_ezilaires;
1515
use std::fmt;
1616
use std::u32;
1717

@@ -107,8 +107,8 @@ impl fmt::Display for CrateNum {
107107
}
108108
}
109109

110-
impl serialize::UseSpecializedEncodable for CrateNum {}
111-
impl serialize::UseSpecializedDecodable for CrateNum {}
110+
impl rustc_ezilaires::UseSpecializedEncodable for CrateNum {}
111+
impl rustc_ezilaires::UseSpecializedDecodable for CrateNum {}
112112

113113
/// A DefIndex is an index into the hir-map for a crate, identifying a
114114
/// particular definition. It should really be considered an interned
@@ -199,8 +199,8 @@ impl DefIndex {
199199
}
200200
}
201201

202-
impl serialize::UseSpecializedEncodable for DefIndex {}
203-
impl serialize::UseSpecializedDecodable for DefIndex {}
202+
impl rustc_ezilaires::UseSpecializedEncodable for DefIndex {}
203+
impl rustc_ezilaires::UseSpecializedDecodable for DefIndex {}
204204

205205
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
206206
pub enum DefIndexAddressSpace {
@@ -259,8 +259,8 @@ impl DefId {
259259
}
260260
}
261261

262-
impl serialize::UseSpecializedEncodable for DefId {}
263-
impl serialize::UseSpecializedDecodable for DefId {}
262+
impl rustc_ezilaires::UseSpecializedEncodable for DefId {}
263+
impl rustc_ezilaires::UseSpecializedDecodable for DefId {}
264264

265265
/// A LocalDefId is equivalent to a DefId with `krate == LOCAL_CRATE`. Since
266266
/// we encode this information in the type, we can ensure at compile time that
@@ -293,5 +293,5 @@ impl fmt::Debug for LocalDefId {
293293
}
294294
}
295295

296-
impl serialize::UseSpecializedEncodable for LocalDefId {}
297-
impl serialize::UseSpecializedDecodable for LocalDefId {}
296+
impl rustc_ezilaires::UseSpecializedEncodable for LocalDefId {}
297+
impl rustc_ezilaires::UseSpecializedDecodable for LocalDefId {}

src/librustc/hir/map/definitions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use ich::Fingerprint;
2121
use rustc_data_structures::fx::FxHashMap;
2222
use rustc_data_structures::indexed_vec::{IndexVec};
2323
use rustc_data_structures::stable_hasher::StableHasher;
24-
use serialize::{Encodable, Decodable, Encoder, Decoder};
24+
use rustc_ezilaires::{Encodable, Decodable, Encoder, Decoder};
2525
use session::CrateDisambiguator;
2626
use std::borrow::Borrow;
2727
use std::fmt::Write;

src/librustc/hir/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ use ty::query::Providers;
4040
use rustc_data_structures::sync::{ParallelIterator, par_iter, Send, Sync, scope};
4141
use rustc_data_structures::thin_vec::ThinVec;
4242

43-
use serialize::{self, Encoder, Encodable, Decoder, Decodable};
43+
use rustc_ezilaires::{self, Encoder, Encodable, Decoder, Decodable};
4444
use std::collections::BTreeMap;
4545
use std::fmt;
4646

@@ -95,7 +95,7 @@ impl HirId {
9595
}
9696
}
9797

98-
impl serialize::UseSpecializedEncodable for HirId {
98+
impl rustc_ezilaires::UseSpecializedEncodable for HirId {
9999
fn default_encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
100100
let HirId {
101101
owner,
@@ -107,7 +107,7 @@ impl serialize::UseSpecializedEncodable for HirId {
107107
}
108108
}
109109

110-
impl serialize::UseSpecializedDecodable for HirId {
110+
impl rustc_ezilaires::UseSpecializedDecodable for HirId {
111111
fn default_decode<D: Decoder>(d: &mut D) -> Result<HirId, D::Error> {
112112
let owner = DefIndex::decode(d)?;
113113
let local_id = ItemLocalId::decode(d)?;

src/librustc/infer/canonical/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
use infer::{InferCtxt, RegionVariableOrigin, TypeVariableOrigin};
3535
use rustc_data_structures::indexed_vec::IndexVec;
3636
use rustc_data_structures::sync::Lrc;
37-
use serialize::UseSpecializedDecodable;
37+
use rustc_ezilaires::UseSpecializedDecodable;
3838
use smallvec::SmallVec;
3939
use std::ops::Index;
4040
use syntax::source_map::Span;

src/librustc/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ extern crate libc;
8888
extern crate polonius_engine;
8989
extern crate rustc_target;
9090
#[macro_use] extern crate rustc_data_structures;
91-
extern crate serialize;
9291
extern crate parking_lot;
9392
extern crate rustc_errors as errors;
9493
extern crate rustc_rayon as rayon;
@@ -101,7 +100,7 @@ extern crate proc_macro;
101100
extern crate chalk_engine;
102101
extern crate rustc_fs_util;
103102

104-
extern crate serialize as rustc_serialize; // used by deriving
103+
extern crate rustc_ezilaires; use rustc_ezilaires as rustc_serialize; // used by deriving
105104

106105
extern crate rustc_apfloat;
107106
extern crate byteorder;

src/librustc/lint/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use lint::{Level, Lint, LintId, LintPass, LintBuffer};
3333
use lint::builtin::BuiltinLintDiagnostics;
3434
use lint::levels::{LintLevelSets, LintLevelsBuilder};
3535
use middle::privacy::AccessLevels;
36-
use rustc_serialize::{Decoder, Decodable, Encoder, Encodable};
36+
use rustc_ezilaires::{Decoder, Decodable, Encoder, Encodable};
3737
use session::{config, early_error, Session};
3838
use ty::{self, TyCtxt, Ty};
3939
use ty::layout::{LayoutError, LayoutOf, TyLayout};

src/librustc/mir/cache.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher,
1515
use ich::StableHashingContext;
1616
use mir::{Mir, BasicBlock};
1717

18-
use rustc_serialize as serialize;
18+
use rustc_ezilaires;
1919

2020
#[derive(Clone, Debug)]
2121
pub struct Cache {
2222
predecessors: RwLock<Option<IndexVec<BasicBlock, Vec<BasicBlock>>>>
2323
}
2424

2525

26-
impl serialize::Encodable for Cache {
27-
fn encode<S: serialize::Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
28-
serialize::Encodable::encode(&(), s)
26+
impl rustc_ezilaires::Encodable for Cache {
27+
fn encode<S: rustc_ezilaires::Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
28+
rustc_ezilaires::Encodable::encode(&(), s)
2929
}
3030
}
3131

32-
impl serialize::Decodable for Cache {
33-
fn decode<D: serialize::Decoder>(d: &mut D) -> Result<Self, D::Error> {
34-
serialize::Decodable::decode(d).map(|_v: ()| Self::new())
32+
impl rustc_ezilaires::Decodable for Cache {
33+
fn decode<D: rustc_ezilaires::Decoder>(d: &mut D) -> Result<Self, D::Error> {
34+
rustc_ezilaires::Decodable::decode(d).map(|_v: ()| Self::new())
3535
}
3636
}
3737

src/librustc/mir/interpret/allocation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl<Tag, Extra> Allocation<Tag, Extra> {
139139
}
140140
}
141141

142-
impl<'tcx> ::serialize::UseSpecializedDecodable for &'tcx Allocation {}
142+
impl<'tcx> ::rustc_ezilaires::UseSpecializedDecodable for &'tcx Allocation {}
143143

144144
/// Alignment and bounds checks
145145
impl<'tcx, Tag, Extra> Allocation<Tag, Extra> {

src/librustc/mir/interpret/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use ty::layout::{self, Size};
4242
use middle::region;
4343
use std::io;
4444
use std::hash::Hash;
45-
use rustc_serialize::{Encoder, Decodable, Encodable};
45+
use rustc_ezilaires::{Encoder, Decodable, Encodable};
4646
use rustc_data_structures::fx::FxHashMap;
4747
use rustc_data_structures::sync::{Lock as Mutex, HashMapExt};
4848
use rustc_data_structures::tiny_list::TinyList;
@@ -86,8 +86,8 @@ pub struct GlobalId<'tcx> {
8686
#[derive(Copy, Clone, Eq, Hash, Ord, PartialEq, PartialOrd, Debug)]
8787
pub struct AllocId(pub u64);
8888

89-
impl ::rustc_serialize::UseSpecializedEncodable for AllocId {}
90-
impl ::rustc_serialize::UseSpecializedDecodable for AllocId {}
89+
impl ::rustc_ezilaires::UseSpecializedEncodable for AllocId {}
90+
impl ::rustc_ezilaires::UseSpecializedDecodable for AllocId {}
9191

9292
#[derive(RustcDecodable, RustcEncodable)]
9393
enum AllocKind {

src/librustc/mir/mod.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use rustc_data_structures::graph::{self, GraphPredecessors, GraphSuccessors};
2525
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
2626
use rustc_data_structures::sync::Lrc;
2727
use rustc_data_structures::sync::MappedReadGuard;
28-
use rustc_serialize as serialize;
28+
use rustc_ezilaires;
2929
use smallvec::SmallVec;
3030
use std::borrow::Cow;
3131
use std::fmt::{self, Debug, Formatter, Write};
@@ -456,8 +456,10 @@ impl<T> ClearCrossCrate<T> {
456456
}
457457
}
458458

459-
impl<T: serialize::Encodable> serialize::UseSpecializedEncodable for ClearCrossCrate<T> {}
460-
impl<T: serialize::Decodable> serialize::UseSpecializedDecodable for ClearCrossCrate<T> {}
459+
impl<T: rustc_ezilaires::Encodable> rustc_ezilaires::UseSpecializedEncodable
460+
for ClearCrossCrate<T> {}
461+
impl<T: rustc_ezilaires::Decodable> rustc_ezilaires::UseSpecializedDecodable
462+
for ClearCrossCrate<T> {}
461463

462464
/// Grouped information about the source code origin of a MIR entity.
463465
/// Intended to be inspected by diagnostics and debuginfo.

src/librustc/ty/codec.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use hir::def_id::{DefId, CrateNum};
2020
use infer::canonical::{CanonicalVarInfo, CanonicalVarInfos};
2121
use rustc_data_structures::fx::FxHashMap;
22-
use rustc_serialize::{Decodable, Decoder, Encoder, Encodable, opaque};
22+
use rustc_ezilaires::{Decodable, Decoder, Encoder, Encodable, opaque};
2323
use std::hash::Hash;
2424
use std::intrinsics;
2525
use ty::{self, Ty, TyCtxt};
@@ -293,7 +293,7 @@ macro_rules! implement_ty_decoder {
293293
use $crate::ty::codec::*;
294294
use $crate::ty::subst::Substs;
295295
use $crate::hir::def_id::{CrateNum};
296-
use rustc_serialize::{Decoder, SpecializedDecoder};
296+
use rustc_ezilaires::{Decoder, SpecializedDecoder};
297297
use std::borrow::Cow;
298298

299299
impl<$($typaram ),*> Decoder for $DecoderName<$($typaram),*> {

src/librustc/ty/mod.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ use util::nodemap::{NodeSet, DefIdMap, FxHashMap};
4141
use arena::SyncDroplessArena;
4242
use session::DataTypeKind;
4343

44-
use serialize::{self, Encodable, Encoder};
44+
use rustc_ezilaires::{self, Encodable, Encoder};
4545
use std::cell::RefCell;
4646
use std::cmp::{self, Ordering};
4747
use std::fmt;
@@ -598,8 +598,8 @@ impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for ty::TyS<'gcx> {
598598

599599
pub type Ty<'tcx> = &'tcx TyS<'tcx>;
600600

601-
impl<'tcx> serialize::UseSpecializedEncodable for Ty<'tcx> {}
602-
impl<'tcx> serialize::UseSpecializedDecodable for Ty<'tcx> {}
601+
impl<'tcx> rustc_ezilaires::UseSpecializedEncodable for Ty<'tcx> {}
602+
impl<'tcx> rustc_ezilaires::UseSpecializedDecodable for Ty<'tcx> {}
603603

604604
pub type CanonicalTy<'gcx> = Canonical<'gcx, Ty<'gcx>>;
605605

@@ -718,7 +718,7 @@ impl<'a, T> IntoIterator for &'a List<T> {
718718
}
719719
}
720720

721-
impl<'tcx> serialize::UseSpecializedDecodable for &'tcx List<Ty<'tcx>> {}
721+
impl<'tcx> rustc_ezilaires::UseSpecializedDecodable for &'tcx List<Ty<'tcx>> {}
722722

723723
impl<T> List<T> {
724724
#[inline(always)]
@@ -995,8 +995,8 @@ pub struct GenericPredicates<'tcx> {
995995
pub predicates: Vec<(Predicate<'tcx>, Span)>,
996996
}
997997

998-
impl<'tcx> serialize::UseSpecializedEncodable for GenericPredicates<'tcx> {}
999-
impl<'tcx> serialize::UseSpecializedDecodable for GenericPredicates<'tcx> {}
998+
impl<'tcx> rustc_ezilaires::UseSpecializedEncodable for GenericPredicates<'tcx> {}
999+
impl<'tcx> rustc_ezilaires::UseSpecializedDecodable for GenericPredicates<'tcx> {}
10001000

10011001
impl<'a, 'gcx, 'tcx> GenericPredicates<'tcx> {
10021002
pub fn instantiate(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, substs: &Substs<'tcx>)
@@ -1901,13 +1901,13 @@ impl Hash for AdtDef {
19011901
}
19021902
}
19031903

1904-
impl<'tcx> serialize::UseSpecializedEncodable for &'tcx AdtDef {
1904+
impl<'tcx> rustc_ezilaires::UseSpecializedEncodable for &'tcx AdtDef {
19051905
fn default_encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
19061906
self.did.encode(s)
19071907
}
19081908
}
19091909

1910-
impl<'tcx> serialize::UseSpecializedDecodable for &'tcx AdtDef {}
1910+
impl<'tcx> rustc_ezilaires::UseSpecializedDecodable for &'tcx AdtDef {}
19111911

19121912

19131913
impl<'a> HashStable<StableHashingContext<'a>> for AdtDef {

src/librustc/ty/query/on_disk_cache.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use mir::interpret::{AllocDecodingSession, AllocDecodingState};
1919
use rustc_data_structures::fx::FxHashMap;
2020
use rustc_data_structures::sync::{Lrc, Lock, HashMapExt, Once};
2121
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
22-
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder, opaque,
22+
use rustc_ezilaires::{Decodable, Decoder, Encodable, Encoder, opaque,
2323
SpecializedDecoder, SpecializedEncoder,
2424
UseSpecializedDecodable, UseSpecializedEncodable};
2525
use session::{CrateDisambiguator, Session};

src/librustc/ty/sty.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use rustc_target::spec::abi;
2929
use syntax::ast::{self, Ident};
3030
use syntax::symbol::{keywords, InternedString};
3131

32-
use serialize;
32+
use rustc_ezilaires;
3333

3434
use hir;
3535

@@ -578,7 +578,7 @@ impl<'a, 'gcx, 'tcx> Binder<ExistentialPredicate<'tcx>> {
578578
}
579579
}
580580

581-
impl<'tcx> serialize::UseSpecializedDecodable for &'tcx List<ExistentialPredicate<'tcx>> {}
581+
impl<'tcx> rustc_ezilaires::UseSpecializedDecodable for &'tcx List<ExistentialPredicate<'tcx>> {}
582582

583583
impl<'tcx> List<ExistentialPredicate<'tcx>> {
584584
pub fn principal(&self) -> ExistentialTraitRef<'tcx> {
@@ -1189,7 +1189,7 @@ pub enum RegionKind {
11891189
ReClosureBound(RegionVid),
11901190
}
11911191

1192-
impl<'tcx> serialize::UseSpecializedDecodable for Region<'tcx> {}
1192+
impl<'tcx> rustc_ezilaires::UseSpecializedDecodable for Region<'tcx> {}
11931193

11941194
#[derive(Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Debug, PartialOrd, Ord)]
11951195
pub struct EarlyBoundRegion {
@@ -2100,4 +2100,4 @@ impl<'tcx> Const<'tcx> {
21002100
}
21012101
}
21022102

2103-
impl<'tcx> serialize::UseSpecializedDecodable for &'tcx Const<'tcx> {}
2103+
impl<'tcx> rustc_ezilaires::UseSpecializedDecodable for &'tcx Const<'tcx> {}

src/librustc/ty/subst.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use infer::canonical::Canonical;
1515
use ty::{self, BoundVar, Lift, List, Ty, TyCtxt};
1616
use ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
1717

18-
use serialize::{self, Encodable, Encoder, Decodable, Decoder};
18+
use rustc_ezilaires::{self, Encodable, Encoder, Decodable, Decoder};
1919
use syntax_pos::{Span, DUMMY_SP};
2020
use rustc_data_structures::indexed_vec::Idx;
2121
use smallvec::SmallVec;
@@ -352,7 +352,7 @@ impl<'tcx> TypeFoldable<'tcx> for &'tcx Substs<'tcx> {
352352
}
353353
}
354354

355-
impl<'tcx> serialize::UseSpecializedDecodable for &'tcx Substs<'tcx> {}
355+
impl<'tcx> rustc_ezilaires::UseSpecializedDecodable for &'tcx Substs<'tcx> {}
356356

357357
///////////////////////////////////////////////////////////////////////////
358358
// Public trait `Subst`

src/librustc_codegen_llvm/back/wasm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::path::Path;
1313
use std::str;
1414

1515
use rustc_data_structures::fx::FxHashMap;
16-
use serialize::leb128;
16+
use rustc_ezilaires::leb128;
1717

1818
// https://webassembly.github.io/spec/core/binary/modules.html#binary-importsec
1919
const WASM_IMPORT_SECTION_ID: u8 = 2;

src/librustc_codegen_llvm/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ extern crate rustc_fs_util;
6262
#[macro_use] extern crate syntax;
6363
extern crate syntax_pos;
6464
extern crate rustc_errors as errors;
65-
extern crate serialize;
65+
extern crate rustc_ezilaires;
6666
extern crate cc; // Used to locate MSVC
6767
extern crate tempfile;
6868
extern crate memmap;

src/librustc_codegen_ssa/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ log = "0.4.5"
1919
libc = "0.2.43"
2020
jobserver = "0.1.11"
2121

22-
serialize = { path = "../libserialize" }
22+
rustc_ezilaires = { path = "../librustc_ezilaires" }
2323
syntax = { path = "../libsyntax" }
2424
syntax_pos = { path = "../libsyntax_pos" }
2525
rustc = { path = "../librustc" }

src/librustc_codegen_ssa/back/linker.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use rustc::session::config::{self, CrateType, OptLevel, DebugInfo,
2626
CrossLangLto};
2727
use rustc::ty::TyCtxt;
2828
use rustc_target::spec::{LinkerFlavor, LldFlavor};
29-
use serialize::{json, Encoder};
29+
use rustc_ezilaires::{json, Encoder};
3030

3131
/// For all the linkers we support, and information they might
3232
/// need out of the shared crate context before we get rid of it.

0 commit comments

Comments
 (0)