about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/token.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index 4bfcc94a083..b7e89b32b70 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -653,6 +653,7 @@ impl<'a> PartialEq<InternedString > for &'a str {
     }
 }
 
+#[cfg(stage0)]
 impl<D:Decoder<E>, E> Decodable<D, E> for InternedString {
     fn decode(d: &mut D) -> Result<InternedString, E> {
         Ok(get_name(get_ident_interner().intern(
@@ -660,12 +661,28 @@ impl<D:Decoder<E>, E> Decodable<D, E> for InternedString {
     }
 }
 
+#[cfg(not(stage0))]
+impl Decodable for InternedString {
+    fn decode<D: Decoder>(d: &mut D) -> Result<InternedString, D::Error> {
+        Ok(get_name(get_ident_interner().intern(
+                    try!(d.read_str())[])))
+    }
+}
+
+#[cfg(stage0)]
 impl<S:Encoder<E>, E> Encodable<S, E> for InternedString {
     fn encode(&self, s: &mut S) -> Result<(), E> {
         s.emit_str(self.string[])
     }
 }
 
+#[cfg(not(stage0))]
+impl Encodable for InternedString {
+    fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
+        s.emit_str(self.string[])
+    }
+}
+
 /// Returns the string contents of a name, using the task-local interner.
 #[inline]
 pub fn get_name(name: ast::Name) -> InternedString {