Skip to content

Commit 6140371

Browse files
committed
cleanup: Remove extern crate serialize as rustc_serializes
1 parent 3ebca72 commit 6140371

File tree

52 files changed

+99
-147
lines changed

Some content is hidden

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

52 files changed

+99
-147
lines changed

src/librustc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ rustc_target = { path = "../librustc_target" }
2727
rustc_macros = { path = "../librustc_macros" }
2828
rustc_data_structures = { path = "../librustc_data_structures" }
2929
errors = { path = "../librustc_errors", package = "rustc_errors" }
30-
serialize = { path = "../libserialize" }
30+
rustc_serialize = { path = "../libserialize", package = "serialize" }
3131
syntax = { path = "../libsyntax" }
3232
syntax_pos = { path = "../libsyntax_pos" }
3333
backtrace = "0.3.3"

src/librustc/hir/def_id.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use crate::ty::{self, TyCtxt};
22
use crate::hir::map::definitions::FIRST_FREE_DEF_INDEX;
33
use rustc_data_structures::indexed_vec::Idx;
4-
use serialize;
54
use std::fmt;
65
use std::u32;
76

@@ -93,8 +92,8 @@ impl fmt::Display for CrateNum {
9392
}
9493
}
9594

96-
impl serialize::UseSpecializedEncodable for CrateNum {}
97-
impl serialize::UseSpecializedDecodable for CrateNum {}
95+
impl rustc_serialize::UseSpecializedEncodable for CrateNum {}
96+
impl rustc_serialize::UseSpecializedDecodable for CrateNum {}
9897

9998
newtype_index! {
10099
/// A DefIndex is an index into the hir-map for a crate, identifying a
@@ -134,8 +133,8 @@ impl DefIndex {
134133
}
135134
}
136135

137-
impl serialize::UseSpecializedEncodable for DefIndex {}
138-
impl serialize::UseSpecializedDecodable for DefIndex {}
136+
impl rustc_serialize::UseSpecializedEncodable for DefIndex {}
137+
impl rustc_serialize::UseSpecializedDecodable for DefIndex {}
139138

140139
/// A `DefId` identifies a particular *definition*, by combining a crate
141140
/// index and a def index.
@@ -186,8 +185,8 @@ impl DefId {
186185
}
187186
}
188187

189-
impl serialize::UseSpecializedEncodable for DefId {}
190-
impl serialize::UseSpecializedDecodable for DefId {}
188+
impl rustc_serialize::UseSpecializedEncodable for DefId {}
189+
impl rustc_serialize::UseSpecializedDecodable for DefId {}
191190

192191
/// A LocalDefId is equivalent to a DefId with `krate == LOCAL_CRATE`. Since
193192
/// we encode this information in the type, we can ensure at compile time that
@@ -220,5 +219,5 @@ impl fmt::Debug for LocalDefId {
220219
}
221220
}
222221

223-
impl serialize::UseSpecializedEncodable for LocalDefId {}
224-
impl serialize::UseSpecializedDecodable for LocalDefId {}
222+
impl rustc_serialize::UseSpecializedEncodable for LocalDefId {}
223+
impl rustc_serialize::UseSpecializedDecodable for LocalDefId {}

src/librustc/hir/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use rustc_data_structures::sync::{par_for_each_in, Send, Sync};
3434
use rustc_data_structures::thin_vec::ThinVec;
3535
use rustc_macros::HashStable;
3636

37-
use serialize::{self, Encoder, Encodable, Decoder, Decodable};
37+
use rustc_serialize::{self, Encoder, Encodable, Decoder, Decodable};
3838
use std::collections::{BTreeSet, BTreeMap};
3939
use std::fmt;
4040
use smallvec::SmallVec;
@@ -92,7 +92,7 @@ impl HirId {
9292
}
9393
}
9494

95-
impl serialize::UseSpecializedEncodable for HirId {
95+
impl rustc_serialize::UseSpecializedEncodable for HirId {
9696
fn default_encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
9797
let HirId {
9898
owner,
@@ -104,7 +104,7 @@ impl serialize::UseSpecializedEncodable for HirId {
104104
}
105105
}
106106

107-
impl serialize::UseSpecializedDecodable for HirId {
107+
impl rustc_serialize::UseSpecializedDecodable for HirId {
108108
fn default_decode<D: Decoder>(d: &mut D) -> Result<HirId, D::Error> {
109109
let owner = DefIndex::decode(d)?;
110110
let local_id = ItemLocalId::decode(d)?;

src/librustc/hir/ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::iter::FromIterator;
77
use std::ops::Deref;
88
use std::{slice, vec};
99

10-
use serialize::{Encodable, Decodable, Encoder, Decoder};
10+
use rustc_serialize::{Encodable, Decodable, Encoder, Decoder};
1111

1212
use rustc_data_structures::stable_hasher::{StableHasher, StableHasherResult,
1313
HashStable};

src/librustc/infer/canonical/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use crate::infer::region_constraints::MemberConstraint;
2727
use crate::mir::interpret::ConstValue;
2828
use rustc_data_structures::indexed_vec::IndexVec;
2929
use rustc_macros::HashStable;
30-
use serialize::UseSpecializedDecodable;
30+
use rustc_serialize::UseSpecializedDecodable;
3131
use smallvec::SmallVec;
3232
use std::ops::Index;
3333
use syntax::source_map::Span;

src/librustc/lib.rs

-8
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,8 @@ extern crate getopts;
7575
extern crate libc;
7676
#[macro_use] extern crate rustc_macros;
7777
#[macro_use] extern crate rustc_data_structures;
78-
7978
#[macro_use] extern crate log;
8079
#[macro_use] extern crate syntax;
81-
82-
// FIXME: This import is used by deriving `RustcDecodable` and `RustcEncodable`. Removing this
83-
// results in a bunch of "failed to resolve" errors. Hopefully, the compiler moves to serde or
84-
// something, and we can get rid of this.
85-
#[allow(rust_2018_idioms)]
86-
extern crate serialize as rustc_serialize;
87-
8880
#[macro_use] extern crate smallvec;
8981

9082
// Use the test crate here so we depend on getopts through it. This allow tools to link to both

src/librustc/lint/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use crate::lint::{LintArray, Level, Lint, LintId, LintPass, LintBuffer};
2323
use crate::lint::builtin::BuiltinLintDiagnostics;
2424
use crate::lint::levels::{LintLevelSets, LintLevelsBuilder};
2525
use crate::middle::privacy::AccessLevels;
26-
use crate::rustc_serialize::{Decoder, Decodable, Encoder, Encodable};
26+
use rustc_serialize::{Decoder, Decodable, Encoder, Encodable};
2727
use crate::session::{config, early_error, Session};
2828
use crate::ty::{self, print::Printer, subst::Kind, TyCtxt, Ty};
2929
use crate::ty::layout::{LayoutError, LayoutOf, TyLayout};

src/librustc/mir/cache.rs

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
11
use rustc_data_structures::indexed_vec::IndexVec;
22
use rustc_data_structures::sync::{RwLock, MappedReadGuard, ReadGuard};
3-
use rustc_data_structures::stable_hasher::{HashStable, StableHasher,
4-
StableHasherResult};
3+
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableHasherResult};
4+
use rustc_serialize::{Encodable, Encoder, Decodable, Decoder};
55
use crate::ich::StableHashingContext;
66
use crate::mir::{Body, BasicBlock};
77

8-
use crate::rustc_serialize as serialize;
9-
108
#[derive(Clone, Debug)]
119
pub struct Cache {
1210
predecessors: RwLock<Option<IndexVec<BasicBlock, Vec<BasicBlock>>>>
1311
}
1412

1513

16-
impl serialize::Encodable for Cache {
17-
fn encode<S: serialize::Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
18-
serialize::Encodable::encode(&(), s)
14+
impl rustc_serialize::Encodable for Cache {
15+
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
16+
Encodable::encode(&(), s)
1917
}
2018
}
2119

22-
impl serialize::Decodable for Cache {
23-
fn decode<D: serialize::Decoder>(d: &mut D) -> Result<Self, D::Error> {
24-
serialize::Decodable::decode(d).map(|_v: ()| Self::new())
20+
impl rustc_serialize::Decodable for Cache {
21+
fn decode<D: Decoder>(d: &mut D) -> Result<Self, D::Error> {
22+
Decodable::decode(d).map(|_v: ()| Self::new())
2523
}
2624
}
2725

src/librustc/mir/interpret/allocation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl<Tag> Allocation<Tag> {
113113
}
114114
}
115115

116-
impl<'tcx> ::serialize::UseSpecializedDecodable for &'tcx Allocation {}
116+
impl<'tcx> rustc_serialize::UseSpecializedDecodable for &'tcx Allocation {}
117117

118118
/// Byte accessors
119119
impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {

src/librustc/mir/interpret/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use crate::hir::def_id::DefId;
2727
use crate::ty::{self, TyCtxt, Instance, subst::UnpackedKind};
2828
use crate::ty::layout::{self, Size};
2929
use std::io;
30-
use crate::rustc_serialize::{Encoder, Decodable, Encodable};
30+
use rustc_serialize::{Encoder, Decodable, Encodable};
3131
use rustc_data_structures::fx::FxHashMap;
3232
use rustc_data_structures::sync::{Lock as Mutex, HashMapExt};
3333
use rustc_data_structures::tiny_list::TinyList;
@@ -51,8 +51,8 @@ pub struct GlobalId<'tcx> {
5151
#[derive(Copy, Clone, Eq, Hash, Ord, PartialEq, PartialOrd, Debug)]
5252
pub struct AllocId(pub u64);
5353

54-
impl crate::rustc_serialize::UseSpecializedEncodable for AllocId {}
55-
impl crate::rustc_serialize::UseSpecializedDecodable for AllocId {}
54+
impl rustc_serialize::UseSpecializedEncodable for AllocId {}
55+
impl rustc_serialize::UseSpecializedDecodable for AllocId {}
5656

5757
#[derive(RustcDecodable, RustcEncodable)]
5858
enum AllocDiscriminant {

src/librustc/mir/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use crate::hir::def_id::DefId;
99
use crate::hir::{self, InlineAsm as HirInlineAsm};
1010
use crate::mir::interpret::{ConstValue, InterpError, Scalar};
1111
use crate::mir::visit::MirVisitable;
12-
use crate::rustc_serialize as serialize;
1312
use crate::ty::adjustment::PointerCast;
1413
use crate::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
1514
use crate::ty::layout::VariantIdx;
@@ -28,6 +27,7 @@ use rustc_data_structures::indexed_vec::{Idx, IndexVec};
2827
use rustc_data_structures::sync::Lrc;
2928
use rustc_data_structures::sync::MappedReadGuard;
3029
use rustc_macros::HashStable;
30+
use rustc_serialize::{Encodable, Decodable};
3131
use smallvec::SmallVec;
3232
use std::borrow::Cow;
3333
use std::fmt::{self, Debug, Display, Formatter, Write};
@@ -463,8 +463,8 @@ impl<T> ClearCrossCrate<T> {
463463
}
464464
}
465465

466-
impl<T: serialize::Encodable> serialize::UseSpecializedEncodable for ClearCrossCrate<T> {}
467-
impl<T: serialize::Decodable> serialize::UseSpecializedDecodable for ClearCrossCrate<T> {}
466+
impl<T: Encodable> rustc_serialize::UseSpecializedEncodable for ClearCrossCrate<T> {}
467+
impl<T: Decodable> rustc_serialize::UseSpecializedDecodable for ClearCrossCrate<T> {}
468468

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

src/librustc/ty/codec.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::arena::ArenaAllocatable;
1010
use crate::hir::def_id::{DefId, CrateNum};
1111
use crate::infer::canonical::{CanonicalVarInfo, CanonicalVarInfos};
1212
use rustc_data_structures::fx::FxHashMap;
13-
use crate::rustc_serialize::{Decodable, Decoder, Encoder, Encodable, opaque};
13+
use rustc_serialize::{Decodable, Decoder, Encoder, Encodable, opaque};
1414
use std::hash::Hash;
1515
use std::intrinsics;
1616
use crate::ty::{self, Ty, TyCtxt};
@@ -333,7 +333,7 @@ macro_rules! implement_ty_decoder {
333333
use $crate::ty::codec::*;
334334
use $crate::ty::subst::SubstsRef;
335335
use $crate::hir::def_id::{CrateNum};
336-
use crate::rustc_serialize::{Decoder, SpecializedDecoder};
336+
use rustc_serialize::{Decoder, SpecializedDecoder};
337337
use std::borrow::Cow;
338338

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

src/librustc/ty/mod.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use crate::util::nodemap::{NodeSet, DefIdMap, FxHashMap};
3232
use arena::SyncDroplessArena;
3333
use crate::session::DataTypeKind;
3434

35-
use serialize::{self, Encodable, Encoder};
35+
use rustc_serialize::{self, Encodable, Encoder};
3636
use std::cell::RefCell;
3737
use std::cmp::{self, Ordering};
3838
use std::fmt;
@@ -588,8 +588,8 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for ty::TyS<'tcx> {
588588

589589
pub type Ty<'tcx> = &'tcx TyS<'tcx>;
590590

591-
impl<'tcx> serialize::UseSpecializedEncodable for Ty<'tcx> {}
592-
impl<'tcx> serialize::UseSpecializedDecodable for Ty<'tcx> {}
591+
impl<'tcx> rustc_serialize::UseSpecializedEncodable for Ty<'tcx> {}
592+
impl<'tcx> rustc_serialize::UseSpecializedDecodable for Ty<'tcx> {}
593593

594594
pub type CanonicalTy<'tcx> = Canonical<'tcx, Ty<'tcx>>;
595595

@@ -708,7 +708,7 @@ impl<'a, T> IntoIterator for &'a List<T> {
708708
}
709709
}
710710

711-
impl<'tcx> serialize::UseSpecializedDecodable for &'tcx List<Ty<'tcx>> {}
711+
impl<'tcx> rustc_serialize::UseSpecializedDecodable for &'tcx List<Ty<'tcx>> {}
712712

713713
impl<T> List<T> {
714714
#[inline(always)]
@@ -1009,8 +1009,8 @@ pub struct GenericPredicates<'tcx> {
10091009
pub predicates: Vec<(Predicate<'tcx>, Span)>,
10101010
}
10111011

1012-
impl<'tcx> serialize::UseSpecializedEncodable for GenericPredicates<'tcx> {}
1013-
impl<'tcx> serialize::UseSpecializedDecodable for GenericPredicates<'tcx> {}
1012+
impl<'tcx> rustc_serialize::UseSpecializedEncodable for GenericPredicates<'tcx> {}
1013+
impl<'tcx> rustc_serialize::UseSpecializedDecodable for GenericPredicates<'tcx> {}
10141014

10151015
impl<'tcx> GenericPredicates<'tcx> {
10161016
pub fn instantiate(
@@ -1985,13 +1985,13 @@ impl Hash for AdtDef {
19851985
}
19861986
}
19871987

1988-
impl<'tcx> serialize::UseSpecializedEncodable for &'tcx AdtDef {
1988+
impl<'tcx> rustc_serialize::UseSpecializedEncodable for &'tcx AdtDef {
19891989
fn default_encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
19901990
self.did.encode(s)
19911991
}
19921992
}
19931993

1994-
impl<'tcx> serialize::UseSpecializedDecodable for &'tcx AdtDef {}
1994+
impl<'tcx> rustc_serialize::UseSpecializedDecodable for &'tcx AdtDef {}
19951995

19961996

19971997
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
@@ -5,7 +5,7 @@ use crate::hir::map::definitions::DefPathHash;
55
use crate::ich::{CachingSourceMapView, Fingerprint};
66
use crate::mir::{self, interpret};
77
use crate::mir::interpret::{AllocDecodingSession, AllocDecodingState};
8-
use crate::rustc_serialize::{Decodable, Decoder, Encodable, Encoder, opaque,
8+
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder, opaque,
99
SpecializedDecoder, SpecializedEncoder,
1010
UseSpecializedDecodable, UseSpecializedEncodable};
1111
use crate::session::{CrateDisambiguator, Session};

src/librustc/ty/sty.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use rustc_target::spec::abi;
2626
use syntax::ast::{self, Ident};
2727
use syntax::symbol::{kw, InternedString};
2828

29-
use serialize;
3029
use self::InferTy::*;
3130
use self::TyKind::*;
3231

@@ -640,7 +639,7 @@ impl<'tcx> Binder<ExistentialPredicate<'tcx>> {
640639
}
641640
}
642641

643-
impl<'tcx> serialize::UseSpecializedDecodable for &'tcx List<ExistentialPredicate<'tcx>> {}
642+
impl<'tcx> rustc_serialize::UseSpecializedDecodable for &'tcx List<ExistentialPredicate<'tcx>> {}
644643

645644
impl<'tcx> List<ExistentialPredicate<'tcx>> {
646645
/// Returns the "principal def id" of this set of existential predicates.
@@ -1324,7 +1323,7 @@ pub enum RegionKind {
13241323
ReClosureBound(RegionVid),
13251324
}
13261325

1327-
impl<'tcx> serialize::UseSpecializedDecodable for Region<'tcx> {}
1326+
impl<'tcx> rustc_serialize::UseSpecializedDecodable for Region<'tcx> {}
13281327

13291328
#[derive(Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Debug, PartialOrd, Ord)]
13301329
pub struct EarlyBoundRegion {
@@ -2333,7 +2332,7 @@ impl<'tcx> Const<'tcx> {
23332332
}
23342333
}
23352334

2336-
impl<'tcx> serialize::UseSpecializedDecodable for &'tcx Const<'tcx> {}
2335+
impl<'tcx> rustc_serialize::UseSpecializedDecodable for &'tcx Const<'tcx> {}
23372336

23382337
/// An inference variable for a const, for use in const generics.
23392338
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd,

src/librustc/ty/subst.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::ty::{self, Lift, List, Ty, TyCtxt, InferConst, ParamConst};
66
use crate::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
77
use crate::mir::interpret::ConstValue;
88

9-
use serialize::{self, Encodable, Encoder, Decodable, Decoder};
9+
use rustc_serialize::{self, Encodable, Encoder, Decodable, Decoder};
1010
use syntax_pos::{Span, DUMMY_SP};
1111
use smallvec::SmallVec;
1212
use rustc_macros::HashStable;
@@ -399,7 +399,7 @@ impl<'tcx> TypeFoldable<'tcx> for SubstsRef<'tcx> {
399399
}
400400
}
401401

402-
impl<'tcx> serialize::UseSpecializedDecodable for SubstsRef<'tcx> {}
402+
impl<'tcx> rustc_serialize::UseSpecializedDecodable for SubstsRef<'tcx> {}
403403

404404
///////////////////////////////////////////////////////////////////////////
405405
// Public trait `Subst`

src/librustc_codegen_ssa/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobserver = "0.1.11"
2020
parking_lot = "0.7"
2121
tempfile = "3.0.5"
2222

23-
serialize = { path = "../libserialize" }
23+
rustc_serialize = { path = "../libserialize", package = "serialize" }
2424
syntax = { path = "../libsyntax" }
2525
syntax_pos = { path = "../libsyntax_pos" }
2626
rustc = { path = "../librustc" }

src/librustc_codegen_ssa/back/linker.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use rustc::session::config::{self, CrateType, OptLevel, DebugInfo,
1616
LinkerPluginLto, Lto};
1717
use rustc::ty::TyCtxt;
1818
use rustc_target::spec::{LinkerFlavor, LldFlavor};
19-
use serialize::{json, Encoder};
19+
use rustc_serialize::{json, Encoder};
2020

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

src/librustc_codegen_ssa/back/wasm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::fs;
22
use std::path::Path;
33
use std::str;
44

5-
use serialize::leb128;
5+
use rustc_serialize::leb128;
66

77
// https://webassembly.github.io/spec/core/binary/modules.html#binary-importsec
88
const WASM_CUSTOM_SECTION_ID: u8 = 0;

src/librustc_data_structures/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ indexmap = "1"
1515
log = "0.4"
1616
jobserver_crate = { version = "0.1.13", package = "jobserver" }
1717
lazy_static = "1"
18-
serialize = { path = "../libserialize" }
18+
rustc_serialize = { path = "../libserialize", package = "serialize" }
1919
graphviz = { path = "../libgraphviz" }
2020
cfg-if = "0.1.2"
2121
crossbeam-utils = { version = "0.6.5", features = ["nightly"] }

0 commit comments

Comments
 (0)