about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc/dep_graph/graph.rs1
-rw-r--r--src/librustc/dep_graph/serialized.rs1
-rw-r--r--src/librustc/lib.rs1
-rw-r--r--src/librustc/middle/region.rs1
-rw-r--r--src/librustc/mir/mod.rs2
-rw-r--r--src/librustc/ty/mod.rs2
-rw-r--r--src/librustc/ty/sty.rs2
-rw-r--r--src/librustc_data_structures/indexed_vec.rs24
-rw-r--r--src/librustc_mir/borrow_check/location.rs1
-rw-r--r--src/librustc_mir/borrow_check/nll/constraints/mod.rs1
-rw-r--r--src/librustc_mir/borrow_check/nll/region_infer/values.rs1
-rw-r--r--src/librustc_mir/borrow_check/nll/type_check/liveness/liveness_map.rs1
-rw-r--r--src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs1
-rw-r--r--src/librustc_mir/build/mod.rs1
14 files changed, 33 insertions, 7 deletions
diff --git a/src/librustc/dep_graph/graph.rs b/src/librustc/dep_graph/graph.rs
index 4c94c993ab4..06287bda63a 100644
--- a/src/librustc/dep_graph/graph.rs
+++ b/src/librustc/dep_graph/graph.rs
@@ -18,6 +18,7 @@ use std::env;
 use std::hash::Hash;
 use ty::{self, TyCtxt};
 use util::common::{ProfileQueriesMsg, profq_msg};
+use serialize::{Decodable, Decoder};
 
 use ich::{StableHashingContext, StableHashingContextProvider, Fingerprint};
 
diff --git a/src/librustc/dep_graph/serialized.rs b/src/librustc/dep_graph/serialized.rs
index 0c6c224fa91..992ebd0efb1 100644
--- a/src/librustc/dep_graph/serialized.rs
+++ b/src/librustc/dep_graph/serialized.rs
@@ -13,6 +13,7 @@
 use dep_graph::DepNode;
 use ich::Fingerprint;
 use rustc_data_structures::indexed_vec::{IndexVec, Idx};
+use serialize::{Decodable, Decoder};
 
 newtype_index! {
     pub struct SerializedDepNodeIndex { .. }
diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs
index ddb0c5bf22a..99412c02c43 100644
--- a/src/librustc/lib.rs
+++ b/src/librustc/lib.rs
@@ -69,6 +69,7 @@
 #![feature(in_band_lifetimes)]
 #![feature(crate_visibility_modifier)]
 #![feature(transpose_result)]
+#![cfg_attr(not(stage0), feature(min_const_unsafe_fn))]
 
 #![recursion_limit="512"]
 
diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs
index 35d1a4dd2cb..1440d91b47e 100644
--- a/src/librustc/middle/region.rs
+++ b/src/librustc/middle/region.rs
@@ -28,6 +28,7 @@ use syntax::ast;
 use syntax_pos::{Span, DUMMY_SP};
 use ty::TyCtxt;
 use ty::query::Providers;
+use serialize::{Decodable, Decoder};
 
 use hir;
 use hir::Node;
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs
index c0581121efa..549e13bad64 100644
--- a/src/librustc/mir/mod.rs
+++ b/src/librustc/mir/mod.rs
@@ -25,7 +25,7 @@ use rustc_data_structures::graph::{self, GraphPredecessors, GraphSuccessors};
 use rustc_data_structures::indexed_vec::{Idx, IndexVec};
 use rustc_data_structures::sync::Lrc;
 use rustc_data_structures::sync::MappedReadGuard;
-use rustc_serialize as serialize;
+use rustc_serialize::{self as serialize, Decodable, Decoder};
 use smallvec::SmallVec;
 use std::borrow::Cow;
 use std::fmt::{self, Debug, Formatter, Write};
diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs
index 4633ab11663..8ff93cee250 100644
--- a/src/librustc/ty/mod.rs
+++ b/src/librustc/ty/mod.rs
@@ -41,7 +41,7 @@ use util::nodemap::{NodeSet, DefIdMap, FxHashMap};
 use arena::SyncDroplessArena;
 use session::DataTypeKind;
 
-use serialize::{self, Encodable, Encoder};
+use serialize::{self, Encodable, Encoder, Decodable, Decoder};
 use std::cell::RefCell;
 use std::cmp::{self, Ordering};
 use std::fmt;
diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs
index 1416cb17fea..fa45b8c7768 100644
--- a/src/librustc/ty/sty.rs
+++ b/src/librustc/ty/sty.rs
@@ -29,7 +29,7 @@ use rustc_target::spec::abi;
 use syntax::ast::{self, Ident};
 use syntax::symbol::{keywords, InternedString};
 
-use serialize;
+use serialize::{self, Decodable, Decoder};
 
 use hir;
 
diff --git a/src/librustc_data_structures/indexed_vec.rs b/src/librustc_data_structures/indexed_vec.rs
index a59bf9d530c..c35490ce35b 100644
--- a/src/librustc_data_structures/indexed_vec.rs
+++ b/src/librustc_data_structures/indexed_vec.rs
@@ -98,12 +98,18 @@ macro_rules! newtype_index {
      @max          [$max:expr]
      @vis          [$v:vis]
      @debug_format [$debug_format:tt]) => (
-        #[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, $($derives),*)]
+        #[derive(Copy, PartialEq, Eq, Hash, PartialOrd, Ord, $($derives),*)]
         #[rustc_layout_scalar_valid_range_end($max)]
         $v struct $type {
             private: u32
         }
 
+        impl Clone for $type {
+            fn clone(&self) -> Self {
+                *self
+            }
+        }
+
         impl $type {
             $v const MAX_AS_U32: u32 = $max;
 
@@ -145,7 +151,7 @@ macro_rules! newtype_index {
 
             #[inline]
             $v const unsafe fn from_u32_unchecked(value: u32) -> Self {
-                $type { private: value }
+                unsafe { $type { private: value } }
             }
 
             /// Extract value of this index as an integer.
@@ -328,12 +334,17 @@ macro_rules! newtype_index {
                    derive [$($derives:ident,)+]
                    $($tokens:tt)*) => (
         newtype_index!(
-            @derives      [$($derives,)+ RustcDecodable, RustcEncodable,]
+            @derives      [$($derives,)+ RustcEncodable,]
             @type         [$type]
             @max          [$max]
             @vis          [$v]
             @debug_format [$debug_format]
                           $($tokens)*);
+        impl Decodable for $type {
+            fn decode<D: Decoder>(d: &mut D) -> Result<Self, D::Error> {
+                d.read_u32().into()
+            }
+        }
     );
 
     // The case where no derives are added, but encodable is overridden. Don't
@@ -360,12 +371,17 @@ macro_rules! newtype_index {
      @debug_format [$debug_format:tt]
                    $($tokens:tt)*) => (
         newtype_index!(
-            @derives      [RustcDecodable, RustcEncodable,]
+            @derives      [RustcEncodable,]
             @type         [$type]
             @max          [$max]
             @vis          [$v]
             @debug_format [$debug_format]
                           $($tokens)*);
+        impl Decodable for $type {
+            fn decode<D: Decoder>(d: &mut D) -> Result<Self, D::Error> {
+                d.read_u32().map(Self::from)
+            }
+        }
     );
 
     // Rewrite final without comma to one that includes comma
diff --git a/src/librustc_mir/borrow_check/location.rs b/src/librustc_mir/borrow_check/location.rs
index b3e159dd844..2d593d85113 100644
--- a/src/librustc_mir/borrow_check/location.rs
+++ b/src/librustc_mir/borrow_check/location.rs
@@ -10,6 +10,7 @@
 
 use rustc::mir::{BasicBlock, Location, Mir};
 use rustc_data_structures::indexed_vec::{Idx, IndexVec};
+use rustc_serialize::{Decodable, Decoder};
 
 /// Maps between a MIR Location, which identifies a particular
 /// statement within a basic block, to a "rich location", which
diff --git a/src/librustc_mir/borrow_check/nll/constraints/mod.rs b/src/librustc_mir/borrow_check/nll/constraints/mod.rs
index a873af8333a..37b11a77184 100644
--- a/src/librustc_mir/borrow_check/nll/constraints/mod.rs
+++ b/src/librustc_mir/borrow_check/nll/constraints/mod.rs
@@ -13,6 +13,7 @@ use rustc::ty::RegionVid;
 use rustc_data_structures::graph::scc::Sccs;
 use rustc_data_structures::indexed_vec::{Idx, IndexVec};
 use borrow_check::nll::type_check::Locations;
+use rustc_serialize::{Decodable, Decoder};
 
 use std::fmt;
 use std::ops::Deref;
diff --git a/src/librustc_mir/borrow_check/nll/region_infer/values.rs b/src/librustc_mir/borrow_check/nll/region_infer/values.rs
index 69e2c896d33..5ce80ca236d 100644
--- a/src/librustc_mir/borrow_check/nll/region_infer/values.rs
+++ b/src/librustc_mir/borrow_check/nll/region_infer/values.rs
@@ -16,6 +16,7 @@ use rustc_data_structures::indexed_vec::Idx;
 use rustc_data_structures::indexed_vec::IndexVec;
 use std::fmt::Debug;
 use std::rc::Rc;
+use rustc_serialize::{Decodable, Decoder};
 
 /// Maps between a `Location` and a `PointIndex` (and vice versa).
 crate struct RegionValueElements {
diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/liveness_map.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/liveness_map.rs
index cc176cbc403..d1a1d2aea24 100644
--- a/src/librustc_mir/borrow_check/nll/type_check/liveness/liveness_map.rs
+++ b/src/librustc_mir/borrow_check/nll/type_check/liveness/liveness_map.rs
@@ -23,6 +23,7 @@ use rustc::ty::{RegionVid, TyCtxt};
 use rustc_data_structures::fx::FxHashSet;
 use rustc_data_structures::indexed_vec::{Idx, IndexVec};
 use util::liveness::LiveVariableMap;
+use rustc_serialize::{Decodable, Decoder};
 
 /// Map between Local and LiveVar indices: the purpose of this
 /// map is to define the subset of local variables for which we need
diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs
index 4b39d58cd96..9e0eaf61e94 100644
--- a/src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs
+++ b/src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs
@@ -15,6 +15,7 @@ use rustc::mir::{Local, Location, Mir};
 use rustc_data_structures::indexed_vec::{Idx, IndexVec};
 use rustc_data_structures::vec_linked_list as vll;
 use util::liveness::{categorize, DefUse, LiveVariableMap};
+use rustc_serialize::{Decodable, Decoder};
 
 /// A map that cross references each local with the locations where it
 /// is defined (assigned), used, or dropped. Used during liveness
diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs
index cc927df6350..1a5a089c7aa 100644
--- a/src/librustc_mir/build/mod.rs
+++ b/src/librustc_mir/build/mod.rs
@@ -32,6 +32,7 @@ use syntax::ast;
 use syntax::attr::{self, UnwindAttr};
 use syntax::symbol::keywords;
 use syntax_pos::Span;
+use rustc_serialize::{Decodable, Decoder};
 use transform::MirSource;
 use util as mir_util;