about summary refs log tree commit diff
path: root/src/libserialize
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-03-24 17:38:09 +0000
committerbors <bors@rust-lang.org>2015-03-24 17:38:09 +0000
commited810385045ab0db90303574ba3ea47dfa2a36d5 (patch)
tree161242c800aca625a26c56551fa5adb446c0089f /src/libserialize
parent28a0b25f424090255966273994748a9f9901059f (diff)
parentd252d0ad5434bcf77076729ab766eeff98f20ead (diff)
downloadrust-ed810385045ab0db90303574ba3ea47dfa2a36d5.tar.gz
rust-ed810385045ab0db90303574ba3ea47dfa2a36d5.zip
Auto merge of #23654 - alexcrichton:rollup, r=alexcrichton
Diffstat (limited to 'src/libserialize')
-rw-r--r--src/libserialize/hex.rs2
-rw-r--r--src/libserialize/json.rs23
-rw-r--r--src/libserialize/lib.rs3
-rw-r--r--src/libserialize/serialize.rs2
4 files changed, 28 insertions, 2 deletions
diff --git a/src/libserialize/hex.rs b/src/libserialize/hex.rs
index 1f8d45a007d..e42aa1835dc 100644
--- a/src/libserialize/hex.rs
+++ b/src/libserialize/hex.rs
@@ -32,6 +32,7 @@ impl ToHex for [u8] {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(rustc_private)]
     /// extern crate serialize;
     /// use serialize::hex::ToHex;
     ///
@@ -101,6 +102,7 @@ impl FromHex for str {
     /// This converts a string literal to hexadecimal and back.
     ///
     /// ```
+    /// # #![feature(rustc_private)]
     /// extern crate serialize;
     /// use serialize::hex::{FromHex, ToHex};
     ///
diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs
index 096c72e6af2..abbfc82319f 100644
--- a/src/libserialize/json.rs
+++ b/src/libserialize/json.rs
@@ -1218,6 +1218,7 @@ impl Json {
     }
 }
 
+#[cfg(stage0)]
 impl<'a> Index<&'a str>  for Json {
     type Output = Json;
 
@@ -1226,6 +1227,16 @@ impl<'a> Index<&'a str>  for Json {
     }
 }
 
+#[cfg(not(stage0))]
+impl<'a> Index<&'a str>  for Json {
+    type Output = Json;
+
+    fn index(&self, idx: &'a str) -> &Json {
+        self.find(idx).unwrap()
+    }
+}
+
+#[cfg(stage0)]
 impl Index<uint> for Json {
     type Output = Json;
 
@@ -1237,6 +1248,18 @@ impl Index<uint> for Json {
     }
 }
 
+#[cfg(not(stage0))]
+impl Index<uint> for Json {
+    type Output = Json;
+
+    fn index<'a>(&'a self, idx: uint) -> &'a Json {
+        match self {
+            &Json::Array(ref v) => &v[idx],
+            _ => panic!("can only index Json with uint if it is an array")
+        }
+    }
+}
+
 /// The output of the streaming parser.
 #[derive(PartialEq, Clone, Debug)]
 pub enum JsonEvent {
diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs
index 90cb88046e5..482e0d1d0ee 100644
--- a/src/libserialize/lib.rs
+++ b/src/libserialize/lib.rs
@@ -37,7 +37,8 @@ Core encoding and decoding interfaces.
 #![feature(std_misc)]
 #![feature(unicode)]
 #![feature(str_char)]
-#![cfg_attr(test, feature(test))]
+#![feature(convert)]
+#![cfg_attr(test, feature(test, old_io))]
 
 // test harness access
 #[cfg(test)] extern crate test;
diff --git a/src/libserialize/serialize.rs b/src/libserialize/serialize.rs
index 71f9e01706d..5e9baa9b9e9 100644
--- a/src/libserialize/serialize.rs
+++ b/src/libserialize/serialize.rs
@@ -579,7 +579,7 @@ impl Encodable for path::PathBuf {
 impl Decodable for path::PathBuf {
     fn decode<D: Decoder>(d: &mut D) -> Result<path::PathBuf, D::Error> {
         let bytes: String = try!(Decodable::decode(d));
-        Ok(path::PathBuf::new(&bytes))
+        Ok(path::PathBuf::from(bytes))
     }
 }