Skip to content

Commit 137a640

Browse files

File tree

15 files changed

+19
-22
lines changed

15 files changed

+19
-22
lines changed
 

‎src/librustc/dep_graph/graph.rs

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use std::env;
1818
use std::hash::Hash;
1919
use ty::{self, TyCtxt};
2020
use util::common::{ProfileQueriesMsg, profq_msg};
21-
use serialize::{Decodable, Decoder};
2221

2322
use ich::{StableHashingContext, StableHashingContextProvider, Fingerprint};
2423

‎src/librustc/dep_graph/serialized.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use dep_graph::DepNode;
1414
use ich::Fingerprint;
1515
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
16-
use serialize::{Decodable, Decoder};
1716

1817
newtype_index! {
1918
pub struct SerializedDepNodeIndex { .. }

‎src/librustc/hir/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ impl serialize::UseSpecializedDecodable for HirId {
122122
// hack to ensure that we don't try to access the private parts of `ItemLocalId` in this module
123123
mod item_local_id_inner {
124124
use rustc_data_structures::indexed_vec::Idx;
125-
use serialize::{Decodable, Decoder};
126125
/// An `ItemLocalId` uniquely identifies something within a given "item-like",
127126
/// that is within a hir::Item, hir::TraitItem, or hir::ImplItem. There is no
128127
/// guarantee that the numerical value of a given `ItemLocalId` corresponds to

‎src/librustc/middle/region.rs

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ use syntax::ast;
2828
use syntax_pos::{Span, DUMMY_SP};
2929
use ty::TyCtxt;
3030
use ty::query::Providers;
31-
use serialize::{Decodable, Decoder};
3231

3332
use hir;
3433
use hir::Node;

‎src/librustc/mir/mod.rs

+1-1
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::{self as serialize, Decodable, Decoder};
28+
use rustc_serialize::{self as serialize};
2929
use smallvec::SmallVec;
3030
use std::borrow::Cow;
3131
use std::fmt::{self, Debug, Formatter, Write};

‎src/librustc/ty/mod.rs

+1-1
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, Decodable, Decoder};
44+
use serialize::{self, Encodable, Encoder};
4545
use std::cell::RefCell;
4646
use std::cmp::{self, Ordering};
4747
use std::fmt;

‎src/librustc/ty/sty.rs

+1-1
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::{self, Decodable, Decoder};
32+
use serialize;
3333

3434
use hir;
3535

‎src/librustc_data_structures/indexed_vec.rs

+16-8
Original file line numberDiff line numberDiff line change
@@ -340,11 +340,7 @@ macro_rules! newtype_index {
340340
@vis [$v]
341341
@debug_format [$debug_format]
342342
$($tokens)*);
343-
impl Decodable for $type {
344-
fn decode<D: Decoder>(d: &mut D) -> Result<Self, D::Error> {
345-
d.read_u32().into()
346-
}
347-
}
343+
newtype_index!(@decodable $type);
348344
);
349345

350346
// The case where no derives are added, but encodable is overridden. Don't
@@ -377,9 +373,21 @@ macro_rules! newtype_index {
377373
@vis [$v]
378374
@debug_format [$debug_format]
379375
$($tokens)*);
380-
impl Decodable for $type {
381-
fn decode<D: Decoder>(d: &mut D) -> Result<Self, D::Error> {
382-
d.read_u32().map(Self::from)
376+
newtype_index!(@decodable $type);
377+
);
378+
379+
(@decodable $type:ident) => (
380+
impl $type {
381+
fn __decodable__impl__hack() {
382+
mod __more_hacks_because__self_doesnt_work_in_functions {
383+
extern crate serialize;
384+
use self::serialize::{Decodable, Decoder};
385+
impl Decodable for super::$type {
386+
fn decode<D: Decoder>(d: &mut D) -> Result<Self, D::Error> {
387+
d.read_u32().map(Self::from)
388+
}
389+
}
390+
}
383391
}
384392
}
385393
);

‎src/librustc_mir/borrow_check/location.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
use rustc::mir::{BasicBlock, Location, Mir};
1212
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
13-
use rustc_serialize::{Decodable, Decoder};
1413

1514
/// Maps between a MIR Location, which identifies a particular
1615
/// statement within a basic block, to a "rich location", which

‎src/librustc_mir/borrow_check/nll/constraints/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use rustc::ty::RegionVid;
1313
use rustc_data_structures::graph::scc::Sccs;
1414
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
1515
use borrow_check::nll::type_check::Locations;
16-
use rustc_serialize::{Decodable, Decoder};
1716

1817
use std::fmt;
1918
use std::ops::Deref;

‎src/librustc_mir/borrow_check/nll/region_infer/values.rs

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use rustc_data_structures::indexed_vec::Idx;
1616
use rustc_data_structures::indexed_vec::IndexVec;
1717
use std::fmt::Debug;
1818
use std::rc::Rc;
19-
use rustc_serialize::{Decodable, Decoder};
2019

2120
/// Maps between a `Location` and a `PointIndex` (and vice versa).
2221
crate struct RegionValueElements {

‎src/librustc_mir/borrow_check/nll/type_check/liveness/liveness_map.rs

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use rustc::ty::{RegionVid, TyCtxt};
2323
use rustc_data_structures::fx::FxHashSet;
2424
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
2525
use util::liveness::LiveVariableMap;
26-
use rustc_serialize::{Decodable, Decoder};
2726

2827
/// Map between Local and LiveVar indices: the purpose of this
2928
/// map is to define the subset of local variables for which we need

‎src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use rustc::mir::{Local, Location, Mir};
1515
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
1616
use rustc_data_structures::vec_linked_list as vll;
1717
use util::liveness::{categorize, DefUse, LiveVariableMap};
18-
use rustc_serialize::{Decodable, Decoder};
1918

2019
/// A map that cross references each local with the locations where it
2120
/// is defined (assigned), used, or dropped. Used during liveness

‎src/librustc_mir/build/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ use syntax::ast;
3232
use syntax::attr::{self, UnwindAttr};
3333
use syntax::symbol::keywords;
3434
use syntax_pos::Span;
35-
use rustc_serialize::{Decodable, Decoder};
3635
use transform::MirSource;
3736
use util as mir_util;
3837

‎src/librustc_target/abi/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use std::fmt;
1717
use std::ops::{Add, Deref, Sub, Mul, AddAssign, Range, RangeInclusive};
1818

1919
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
20-
use rustc_serialize::{Decodable, Decoder};
2120

2221
pub mod call;
2322

0 commit comments

Comments
 (0)
Please sign in to comment.