Skip to content

Commit 3a44115

Browse files
committed
Add Rustc prefixes to derive(Decodable, Encodable).
As a bit of a hack, make `rustc_serialize` an alias of the private `serialize` crate, just so the new derive continues working. Fix #54287.
1 parent 43061d3 commit 3a44115

6 files changed

+16
-10
lines changed

src/test/run-pass-fulldeps/deriving-encodable-decodable-box.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@
1414
#![feature(rustc_private)]
1515

1616
extern crate serialize;
17+
use serialize as rustc_serialize;
1718

1819
use serialize::{Encodable, Decodable};
1920
use serialize::json;
2021

21-
#[derive(Encodable, Decodable)]
22+
#[derive(RustcEncodable, RustcDecodable)]
2223
struct A {
2324
foo: Box<[bool]>,
2425
}

src/test/run-pass-fulldeps/deriving-encodable-decodable-cell-refcell.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,18 @@
1616
#![feature(rustc_private)]
1717

1818
extern crate serialize;
19+
use serialize as rustc_serialize;
1920

2021
use std::cell::{Cell, RefCell};
2122
use serialize::{Encodable, Decodable};
2223
use serialize::json;
2324

24-
#[derive(Encodable, Decodable)]
25+
#[derive(RustcEncodable, RustcDecodable)]
2526
struct A {
2627
baz: isize
2728
}
2829

29-
#[derive(Encodable, Decodable)]
30+
#[derive(RustcEncodable, RustcDecodable)]
3031
struct B {
3132
foo: Cell<bool>,
3233
bar: RefCell<A>,

src/test/run-pass-fulldeps/deriving-global.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#![feature(rustc_private)]
1212

1313
extern crate serialize;
14+
use serialize as rustc_serialize;
1415

1516
mod submod {
1617
// if any of these are implemented without global calls for any
@@ -20,21 +21,21 @@ mod submod {
2021
Hash,
2122
Clone,
2223
Debug,
23-
Encodable, Decodable)]
24+
RustcEncodable, RustcDecodable)]
2425
enum A { A1(usize), A2(isize) }
2526

2627
#[derive(PartialEq, PartialOrd, Eq, Ord,
2728
Hash,
2829
Clone,
2930
Debug,
30-
Encodable, Decodable)]
31+
RustcEncodable, RustcDecodable)]
3132
struct B { x: usize, y: isize }
3233

3334
#[derive(PartialEq, PartialOrd, Eq, Ord,
3435
Hash,
3536
Clone,
3637
Debug,
37-
Encodable, Decodable)]
38+
RustcEncodable, RustcDecodable)]
3839
struct C(usize, isize);
3940

4041
}

src/test/run-pass-fulldeps/deriving-hygiene.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#![allow(non_upper_case_globals)]
1212
#![feature(rustc_private)]
1313
extern crate serialize;
14+
use serialize as rustc_serialize;
1415

1516
pub const other: u8 = 1;
1617
pub const f: u8 = 1;
@@ -19,7 +20,7 @@ pub const s: u8 = 1;
1920
pub const state: u8 = 1;
2021
pub const cmp: u8 = 1;
2122

22-
#[derive(Ord,Eq,PartialOrd,PartialEq,Debug,Decodable,Encodable,Hash)]
23+
#[derive(Ord,Eq,PartialOrd,PartialEq,Debug,RustcDecodable,RustcEncodable,Hash)]
2324
struct Foo {}
2425

2526
fn main() {

src/test/run-pass-fulldeps/issue-11881.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#![feature(rustc_private)]
1616

1717
extern crate serialize;
18+
use serialize as rustc_serialize;
1819

1920
use std::io::Cursor;
2021
use std::io::prelude::*;
@@ -25,12 +26,12 @@ use serialize::{Encodable, Encoder};
2526
use serialize::json;
2627
use serialize::opaque;
2728

28-
#[derive(Encodable)]
29+
#[derive(RustcEncodable)]
2930
struct Foo {
3031
baz: bool,
3132
}
3233

33-
#[derive(Encodable)]
34+
#[derive(RustcEncodable)]
3435
struct Bar {
3536
froboz: usize,
3637
}

src/test/run-pass-fulldeps/issue-14021.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
#![feature(rustc_private)]
1414

1515
extern crate serialize;
16+
extern crate serialize as rustc_serialize;
1617

1718
use serialize::{Encodable, Decodable};
1819
use serialize::json;
1920

20-
#[derive(Encodable, Decodable, PartialEq, Debug)]
21+
#[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)]
2122
struct UnitLikeStruct;
2223

2324
pub fn main() {

0 commit comments

Comments
 (0)