]> git.lizzy.rs Git - rust.git/commitdiff
rollup merge of #20033: alexcrichton/deprecate-serialise
authorAlex Crichton <alex@alexcrichton.com>
Mon, 22 Dec 2014 20:46:31 +0000 (12:46 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Mon, 22 Dec 2014 20:46:31 +0000 (12:46 -0800)
This commit completes the deprecation story for the in-tree serialization
library. The compiler will now emit a warning whenever it encounters
`deriving(Encodable)` or `deriving(Decodable)`, and the library itself is now
marked `#[unstable]` for when feature staging is enabled.

All users of serialization can migrate to the `rustc-serialize` crate on
crates.io which provides the exact same interface as the libserialize library
in-tree. The new deriving modes are named `RustcEncodable` and `RustcDecodable`
and require `extern crate "rustc-serialize" as rustc_serialize` at the crate
root in order to expand correctly.

To migrate all crates, add the following to your `Cargo.toml`:

    [dependencies]
    rustc-serialize = "0.1.1"

And then add the following to your crate root:

    extern crate "rustc-serialize" as rustc_serialize;

Finally, rename `Encodable` and `Decodable` deriving modes to `RustcEncodable`
and `RustcDecodable`.

[breaking-change]

15 files changed:
1  2 
src/librustc/lib.rs
src/librustc/middle/resolve_lifetime.rs
src/librustc/middle/subst.rs
src/librustc/middle/ty.rs
src/libserialize/json.rs
src/libserialize/lib.rs
src/libsyntax/ast.rs
src/libsyntax/ast_util.rs
src/libsyntax/attr.rs
src/libsyntax/codemap.rs
src/libsyntax/ext/deriving/decodable.rs
src/libsyntax/ext/deriving/encodable.rs
src/libsyntax/ext/deriving/mod.rs
src/libsyntax/parse/token.rs
src/libtest/lib.rs

Simple merge
Simple merge
Simple merge
index c4f071994dc9cd4747bd0426026003d301058b2a,15e7de0801631cfcc0d4a819dff2ceb217f11c40..b945bced512f8cc43449e3f6c49b407754114d6f
@@@ -2450,12 -2450,12 +2450,12 @@@ mod tests 
      #[test]
      fn test_decode_option_malformed() {
          check_err::<OptionData>("{ \"opt\": [] }",
 -                                ExpectedError("Number".into_string(), "[]".into_string()));
 +                                ExpectedError("Number".to_string(), "[]".to_string()));
          check_err::<OptionData>("{ \"opt\": false }",
 -                                ExpectedError("Number".into_string(), "false".into_string()));
 +                                ExpectedError("Number".to_string(), "false".to_string()));
      }
  
-     #[deriving(PartialEq, Encodable, Decodable, Show)]
+     #[deriving(PartialEq, RustcEncodable, RustcDecodable, Show)]
      enum Animal {
          Dog,
          Frog(string::String, int)
Simple merge
index 3eea5b27f1956a45a7b12050c9c8751b452b14ac,b37914ed429a10f5c6d5115bab7bca4c805f2519..9d4bf77d4a5d33c40977d9136e7c50b1730bcbc7
@@@ -187,9 -188,9 +188,9 @@@ impl<S: Encoder<E>, E> Encodable<S, E> 
      }
  }
  
- impl<D:Decoder<E>, E> Decodable<D, E> for Ident {
+ impl<D: Decoder<E>, E> Decodable<D, E> for Ident {
      fn decode(d: &mut D) -> Result<Ident, E> {
 -        Ok(str_to_ident(try!(d.read_str()).as_slice()))
 +        Ok(str_to_ident(try!(d.read_str())[]))
      }
  }
  
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge