]> git.lizzy.rs Git - rust.git/blob - src/test/ui-fulldeps/deriving-encodable-decodable-box.rs
Auto merge of #91356 - GuillaumeGomez:improve-rustdoc-layout, r=jsha
[rust.git] / src / test / ui-fulldeps / deriving-encodable-decodable-box.rs
1 // run-pass
2
3 #![allow(unused_imports)]
4 #![feature(rustc_private)]
5
6 extern crate rustc_macros;
7 extern crate rustc_serialize;
8
9 use rustc_macros::{Decodable, Encodable};
10 use rustc_serialize::json;
11 use rustc_serialize::{Decodable, Encodable};
12
13 #[derive(Encodable, Decodable)]
14 struct A {
15     foo: Box<[bool]>,
16 }
17
18 fn main() {
19     let obj = A { foo: Box::new([true, false]) };
20     let s = json::encode(&obj).unwrap();
21     let obj2: A = json::decode(&s).unwrap();
22     assert_eq!(obj.foo, obj2.foo);
23 }