Skip to content

Commit 5cb4f4e

Browse files
committed
Fix ui fulldeps tests
1 parent e46c58f commit 5cb4f4e

12 files changed

+75
-88
lines changed

src/test/ui-fulldeps/derive-no-std-not-supported.rs

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/test/ui-fulldeps/deriving-encodable-decodable-box.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
// run-pass
22

33
#![allow(unused_imports)]
4-
54
#![feature(box_syntax)]
65
#![feature(rustc_private)]
76

7+
extern crate rustc_macros;
88
extern crate rustc_serialize;
99

10-
use rustc_serialize::{Encodable, Decodable};
10+
use rustc_macros::{Decodable, Encodable};
1111
use rustc_serialize::json;
12+
use rustc_serialize::{Decodable, Encodable};
1213

13-
#[derive(RustcEncodable, RustcDecodable)]
14+
#[derive(Encodable, Decodable)]
1415
struct A {
1516
foo: Box<[bool]>,
1617
}

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

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,29 @@
33
#![allow(unused_imports)]
44
// This briefly tests the capability of `Cell` and `RefCell` to implement the
55
// `Encodable` and `Decodable` traits via `#[derive(Encodable, Decodable)]`
6-
7-
86
#![feature(rustc_private)]
97

8+
extern crate rustc_macros;
109
extern crate rustc_serialize;
1110

12-
use std::cell::{Cell, RefCell};
13-
use rustc_serialize::{Encodable, Decodable};
11+
use rustc_macros::{Decodable, Encodable};
1412
use rustc_serialize::json;
13+
use rustc_serialize::{Decodable, Encodable};
14+
use std::cell::{Cell, RefCell};
1515

16-
#[derive(RustcEncodable, RustcDecodable)]
16+
#[derive(Encodable, Decodable)]
1717
struct A {
18-
baz: isize
18+
baz: isize,
1919
}
2020

21-
#[derive(RustcEncodable, RustcDecodable)]
21+
#[derive(Encodable, Decodable)]
2222
struct B {
2323
foo: Cell<bool>,
2424
bar: RefCell<A>,
2525
}
2626

2727
fn main() {
28-
let obj = B {
29-
foo: Cell::new(true),
30-
bar: RefCell::new( A { baz: 2 } )
31-
};
28+
let obj = B { foo: Cell::new(true), bar: RefCell::new(A { baz: 2 }) };
3229
let s = json::encode(&obj).unwrap();
3330
let obj2: B = json::decode(&s).unwrap();
3431
assert_eq!(obj.foo.get(), obj2.foo.get());

src/test/ui-fulldeps/deriving-global.rs

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,29 @@
22

33
#![feature(rustc_private)]
44

5+
extern crate rustc_macros;
56
extern crate rustc_serialize;
67

78
mod submod {
9+
use rustc_macros::{Decodable, Encodable};
10+
811
// if any of these are implemented without global calls for any
912
// function calls, then being in a submodule will (correctly)
1013
// cause errors about unrecognised module `std` (or `extra`)
11-
#[derive(PartialEq, PartialOrd, Eq, Ord,
12-
Hash,
13-
Clone,
14-
Debug,
15-
RustcEncodable, RustcDecodable)]
16-
enum A { A1(usize), A2(isize) }
14+
#[derive(PartialEq, PartialOrd, Eq, Ord, Hash, Clone, Debug, Encodable, Decodable)]
15+
enum A {
16+
A1(usize),
17+
A2(isize),
18+
}
1719

18-
#[derive(PartialEq, PartialOrd, Eq, Ord,
19-
Hash,
20-
Clone,
21-
Debug,
22-
RustcEncodable, RustcDecodable)]
23-
struct B { x: usize, y: isize }
20+
#[derive(PartialEq, PartialOrd, Eq, Ord, Hash, Clone, Debug, Encodable, Decodable)]
21+
struct B {
22+
x: usize,
23+
y: isize,
24+
}
2425

25-
#[derive(PartialEq, PartialOrd, Eq, Ord,
26-
Hash,
27-
Clone,
28-
Debug,
29-
RustcEncodable, RustcDecodable)]
26+
#[derive(PartialEq, PartialOrd, Eq, Ord, Hash, Clone, Debug, Encodable, Decodable)]
3027
struct C(usize, isize);
31-
3228
}
3329

3430
pub fn main() {}

src/test/ui-fulldeps/deriving-hygiene.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22

33
#![allow(non_upper_case_globals)]
44
#![feature(rustc_private)]
5+
extern crate rustc_macros;
56
extern crate rustc_serialize;
67

8+
use rustc_macros::{Decodable, Encodable};
9+
710
pub const other: u8 = 1;
811
pub const f: u8 = 1;
912
pub const d: u8 = 1;
1013
pub const s: u8 = 1;
1114
pub const state: u8 = 1;
1215
pub const cmp: u8 = 1;
1316

14-
#[derive(Ord,Eq,PartialOrd,PartialEq,Debug,RustcDecodable,RustcEncodable,Hash)]
17+
#[derive(Ord, Eq, PartialOrd, PartialEq, Debug, Decodable, Encodable, Hash)]
1518
struct Foo {}
1619

17-
fn main() {
18-
}
20+
fn main() {}

src/test/ui-fulldeps/empty-struct-braces-derive.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33

44
#![feature(rustc_private)]
55

6+
extern crate rustc_macros;
67
extern crate rustc_serialize;
78

8-
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash,
9-
Default, Debug, RustcEncodable, RustcDecodable)]
9+
use rustc_macros::{Decodable, Encodable};
10+
11+
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default, Debug, Encodable, Decodable)]
1012
struct S {}
1113

12-
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash,
13-
Default, Debug, RustcEncodable, RustcDecodable)]
14+
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default, Debug, Encodable, Decodable)]
1415
struct Z();
1516

16-
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash,
17-
Debug, RustcEncodable, RustcDecodable)]
17+
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Encodable, Decodable)]
1818
enum E {
1919
V {},
2020
U,

src/test/ui-fulldeps/issue-11881.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,27 @@
33
#![allow(unused_must_use)]
44
#![allow(dead_code)]
55
#![allow(unused_imports)]
6-
76
#![feature(rustc_private)]
87

8+
extern crate rustc_macros;
99
extern crate rustc_serialize;
1010

11-
use std::io::Cursor;
12-
use std::io::prelude::*;
1311
use std::fmt;
12+
use std::io::prelude::*;
13+
use std::io::Cursor;
1414
use std::slice;
1515

16-
use rustc_serialize::{Encodable, Encoder};
16+
use rustc_macros::Encodable;
1717
use rustc_serialize::json;
1818
use rustc_serialize::opaque;
19+
use rustc_serialize::{Encodable, Encoder};
1920

20-
#[derive(RustcEncodable)]
21+
#[derive(Encodable)]
2122
struct Foo {
2223
baz: bool,
2324
}
2425

25-
#[derive(RustcEncodable)]
26+
#[derive(Encodable)]
2627
struct Bar {
2728
froboz: usize,
2829
}
@@ -33,19 +34,19 @@ enum WireProtocol {
3334
// ...
3435
}
3536

36-
fn encode_json<T: Encodable>(val: &T, wr: &mut Cursor<Vec<u8>>) {
37+
fn encode_json<T: for<'a> Encodable<json::Encoder<'a>>>(val: &T, wr: &mut Cursor<Vec<u8>>) {
3738
write!(wr, "{}", json::as_json(val));
3839
}
39-
fn encode_opaque<T: Encodable>(val: &T, wr: Vec<u8>) {
40+
fn encode_opaque<T: Encodable<opaque::Encoder>>(val: &T, wr: Vec<u8>) {
4041
let mut encoder = opaque::Encoder::new(wr);
4142
val.encode(&mut encoder);
4243
}
4344

4445
pub fn main() {
45-
let target = Foo{baz: false,};
46+
let target = Foo { baz: false };
4647
let proto = WireProtocol::JSON;
4748
match proto {
4849
WireProtocol::JSON => encode_json(&target, &mut Cursor::new(Vec::new())),
49-
WireProtocol::Opaque => encode_opaque(&target, Vec::new())
50+
WireProtocol::Opaque => encode_opaque(&target, Vec::new()),
5051
}
5152
}

src/test/ui-fulldeps/issue-14021.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
#![allow(unused_imports)]
55
#![feature(rustc_private)]
66

7+
extern crate rustc_macros;
78
extern crate rustc_serialize;
89

9-
use rustc_serialize::{Encodable, Decodable};
10+
use rustc_macros::{Decodable, Encodable};
1011
use rustc_serialize::json;
12+
use rustc_serialize::{Decodable, Encodable};
1113

12-
#[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)]
14+
#[derive(Encodable, Decodable, PartialEq, Debug)]
1315
struct UnitLikeStruct;
1416

1517
pub fn main() {

src/test/ui-fulldeps/issue-15924.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@
33
#![allow(unused_imports)]
44
#![allow(unused_must_use)]
55
// pretty-expanded FIXME #23616
6-
76
#![feature(rustc_private)]
87

98
extern crate rustc_serialize;
109

11-
use std::fmt;
12-
use rustc_serialize::{Encoder, Encodable};
1310
use rustc_serialize::json;
11+
use rustc_serialize::{Encodable, Encoder};
12+
use std::fmt;
1413

15-
struct Foo<T: Encodable> {
14+
struct Foo<T: for<'a> Encodable<json::Encoder<'a>>> {
1615
v: T,
1716
}
1817

19-
impl<T: Encodable> Drop for Foo<T> {
18+
impl<T: for<'a> Encodable<json::Encoder<'a>>> Drop for Foo<T> {
2019
fn drop(&mut self) {
2120
json::encode(&self.v);
2221
}

src/test/ui-fulldeps/issue-24972.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,18 @@
55

66
extern crate rustc_serialize;
77

8-
use rustc_serialize::{Encodable, Decodable};
8+
use rustc_serialize::{json, Decodable, Encodable};
99
use std::fmt::Display;
1010

11-
pub trait Entity : Decodable + Encodable + Sized {
12-
type Key: Clone + Decodable + Encodable + ToString + Display + Eq + Ord + Sized;
11+
pub trait Entity: Decodable<json::Decoder> + for<'a> Encodable<json::Encoder<'a>> + Sized {
12+
type Key: Clone
13+
+ Decodable<json::Decoder>
14+
+ for<'a> Encodable<json::Encoder<'a>>
15+
+ ToString
16+
+ Display
17+
+ Eq
18+
+ Ord
19+
+ Sized;
1320

1421
fn id(&self) -> Self::Key;
1522

@@ -20,7 +27,10 @@ pub struct DbRef<E: Entity> {
2027
pub id: E::Key,
2128
}
2229

23-
impl<E> DbRef<E> where E: Entity {
30+
impl<E> DbRef<E>
31+
where
32+
E: Entity,
33+
{
2434
fn get(self) -> Option<E> {
2535
E::find_by_id(self.id)
2636
}

src/test/ui-fulldeps/issue-4016.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
// run-pass
22

33
#![allow(dead_code)]
4-
54
#![feature(rustc_private)]
65

76
extern crate rustc_serialize;
87

98
use rustc_serialize::{json, Decodable};
109

11-
trait JD : Decodable {}
10+
trait JD: Decodable<json::Decoder> {}
1211

1312
fn exec<T: JD>() {
1413
let doc = json::from_str("").unwrap();

src/test/ui-fulldeps/rustc_encodable_hygiene.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
#![feature(rustc_private)]
44

5+
extern crate rustc_macros;
56
#[allow(dead_code)]
6-
77
extern crate rustc_serialize;
88

9-
#[derive(RustcDecodable, RustcEncodable,Debug)]
9+
use rustc_macros::{Decodable, Encodable};
10+
11+
#[derive(Decodable, Encodable, Debug)]
1012
struct A {
1113
a: String,
1214
}

0 commit comments

Comments
 (0)