Skip to content

Commit ca87704

Browse files
committed
tests: remove uses of Gc.
1 parent 314b5ba commit ca87704

File tree

206 files changed

+322
-3702
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

206 files changed

+322
-3702
lines changed

src/liballoc/rc.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -541,14 +541,6 @@ mod tests {
541541
assert!(y.upgrade().is_none());
542542
}
543543

544-
#[test]
545-
fn gc_inside() {
546-
// see issue #11532
547-
use std::gc::GC;
548-
let a = Rc::new(RefCell::new(box(GC) 1i));
549-
assert!(a.try_borrow_mut().is_some());
550-
}
551-
552544
#[test]
553545
fn weak_self_cyclic() {
554546
struct Cycle {

src/libcollections/ringbuf.rs

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,6 @@ impl<T: fmt::Show> fmt::Show for RingBuf<T> {
532532
mod tests {
533533
use std::fmt::Show;
534534
use std::prelude::*;
535-
use std::gc::{GC, Gc};
536535
use std::hash;
537536
use test::Bencher;
538537
use test;
@@ -587,43 +586,6 @@ mod tests {
587586
assert_eq!(*d.get(3), 4);
588587
}
589588

590-
#[test]
591-
#[allow(deprecated)]
592-
fn test_boxes() {
593-
let a: Gc<int> = box(GC) 5;
594-
let b: Gc<int> = box(GC) 72;
595-
let c: Gc<int> = box(GC) 64;
596-
let d: Gc<int> = box(GC) 175;
597-
598-
let mut deq = RingBuf::new();
599-
assert_eq!(deq.len(), 0);
600-
deq.push_front(a);
601-
deq.push_front(b);
602-
deq.push(c);
603-
assert_eq!(deq.len(), 3);
604-
deq.push(d);
605-
assert_eq!(deq.len(), 4);
606-
assert_eq!(deq.front(), Some(&b));
607-
assert_eq!(deq.back(), Some(&d));
608-
assert_eq!(deq.pop_front(), Some(b));
609-
assert_eq!(deq.pop(), Some(d));
610-
assert_eq!(deq.pop(), Some(c));
611-
assert_eq!(deq.pop(), Some(a));
612-
assert_eq!(deq.len(), 0);
613-
deq.push(c);
614-
assert_eq!(deq.len(), 1);
615-
deq.push_front(b);
616-
assert_eq!(deq.len(), 2);
617-
deq.push(d);
618-
assert_eq!(deq.len(), 3);
619-
deq.push_front(a);
620-
assert_eq!(deq.len(), 4);
621-
assert_eq!(*deq.get(0), a);
622-
assert_eq!(*deq.get(1), b);
623-
assert_eq!(*deq.get(2), c);
624-
assert_eq!(*deq.get(3), d);
625-
}
626-
627589
#[cfg(test)]
628590
fn test_parameterized<T:Clone + PartialEq + Show>(a: T, b: T, c: T, d: T) {
629591
let mut deq = RingBuf::new();
@@ -755,12 +717,6 @@ mod tests {
755717
test_parameterized::<int>(5, 72, 64, 175);
756718
}
757719

758-
#[test]
759-
fn test_param_at_int() {
760-
test_parameterized::<Gc<int>>(box(GC) 5, box(GC) 72,
761-
box(GC) 64, box(GC) 175);
762-
}
763-
764720
#[test]
765721
fn test_param_taggy() {
766722
test_parameterized::<Taggy>(One(1), Two(1, 2), Three(1, 2, 3), Two(17, 42));

src/libcoretest/iter.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,8 @@ fn test_rposition() {
528528
#[test]
529529
#[should_fail]
530530
fn test_rposition_fail() {
531-
use std::gc::GC;
532-
let v = [(box 0i, box(GC) 0i), (box 0i, box(GC) 0i),
533-
(box 0i, box(GC) 0i), (box 0i, box(GC) 0i)];
531+
let v = [(box 0i, box 0i), (box 0i, box 0i),
532+
(box 0i, box 0i), (box 0i, box 0i)];
534533
let mut i = 0i;
535534
v.iter().rposition(|_elt| {
536535
if i == 2 {

src/libdebug/repr.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,6 @@ fn test_repr() {
572572
use std::io::stdio::println;
573573
use std::char::is_alphabetic;
574574
use std::mem::swap;
575-
use std::gc::GC;
576575

577576
fn exact_test<T>(t: &T, e:&str) {
578577
let mut m = io::MemWriter::new();
@@ -587,7 +586,6 @@ fn test_repr() {
587586
exact_test(&1.234f64, "1.234f64");
588587
exact_test(&("hello"), "\"hello\"");
589588

590-
exact_test(&(box(GC) 10i), "box(GC) 10");
591589
exact_test(&(box 10i), "box 10");
592590
exact_test(&(&10i), "&10");
593591
let mut x = 10i;
@@ -601,8 +599,6 @@ fn test_repr() {
601599
"&[\"hi\", \"there\"]");
602600
exact_test(&(P{a:10, b:1.234}),
603601
"repr::P{a: 10, b: 1.234f64}");
604-
exact_test(&(box(GC) P{a:10, b:1.234}),
605-
"box(GC) repr::P{a: 10, b: 1.234f64}");
606602
exact_test(&(box P{a:10, b:1.234}),
607603
"box repr::P{a: 10, b: 1.234f64}");
608604

src/librustrt/local_data.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,6 @@ mod tests {
411411
extern crate test;
412412

413413
use std::prelude::*;
414-
use std::gc::{Gc, GC};
415414
use super::*;
416415
use std::task;
417416

@@ -467,25 +466,25 @@ mod tests {
467466
#[test]
468467
fn test_tls_multiple_types() {
469468
static str_key: Key<String> = &KeyValueKey;
470-
static box_key: Key<Gc<()>> = &KeyValueKey;
469+
static box_key: Key<Box<int>> = &KeyValueKey;
471470
static int_key: Key<int> = &KeyValueKey;
472471
task::spawn(proc() {
473472
str_key.replace(Some("string data".to_string()));
474-
box_key.replace(Some(box(GC) ()));
473+
box_key.replace(Some(box 0));
475474
int_key.replace(Some(42));
476475
});
477476
}
478477

479478
#[test]
480479
fn test_tls_overwrite_multiple_types() {
481480
static str_key: Key<String> = &KeyValueKey;
482-
static box_key: Key<Gc<()>> = &KeyValueKey;
481+
static box_key: Key<Box<int>> = &KeyValueKey;
483482
static int_key: Key<int> = &KeyValueKey;
484483
task::spawn(proc() {
485484
str_key.replace(Some("string data".to_string()));
486485
str_key.replace(Some("string data 2".to_string()));
487-
box_key.replace(Some(box(GC) ()));
488-
box_key.replace(Some(box(GC) ()));
486+
box_key.replace(Some(box 0));
487+
box_key.replace(Some(box 1));
489488
int_key.replace(Some(42));
490489
// This could cause a segfault if overwriting-destruction is done
491490
// with the crazy polymorphic transmute rather than the provided
@@ -498,13 +497,13 @@ mod tests {
498497
#[should_fail]
499498
fn test_tls_cleanup_on_failure() {
500499
static str_key: Key<String> = &KeyValueKey;
501-
static box_key: Key<Gc<()>> = &KeyValueKey;
500+
static box_key: Key<Box<int>> = &KeyValueKey;
502501
static int_key: Key<int> = &KeyValueKey;
503502
str_key.replace(Some("parent data".to_string()));
504-
box_key.replace(Some(box(GC) ()));
503+
box_key.replace(Some(box 0));
505504
task::spawn(proc() {
506505
str_key.replace(Some("string data".to_string()));
507-
box_key.replace(Some(box(GC) ()));
506+
box_key.replace(Some(box 2));
508507
int_key.replace(Some(42));
509508
fail!();
510509
});

src/librustrt/task.rs

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -554,23 +554,14 @@ mod test {
554554
use super::*;
555555
use std::prelude::*;
556556
use std::task;
557-
use std::gc::{Gc, GC};
558-
559-
#[test]
560-
fn local_heap() {
561-
let a = box(GC) 5i;
562-
let b = a;
563-
assert!(*a == 5);
564-
assert!(*b == 5);
565-
}
566557

567558
#[test]
568559
fn tls() {
569-
local_data_key!(key: Gc<String>)
570-
key.replace(Some(box(GC) "data".to_string()));
560+
local_data_key!(key: String)
561+
key.replace(Some("data".to_string()));
571562
assert_eq!(key.get().unwrap().as_slice(), "data");
572-
local_data_key!(key2: Gc<String>)
573-
key2.replace(Some(box(GC) "data".to_string()));
563+
local_data_key!(key2: String)
564+
key2.replace(Some("data".to_string()));
574565
assert_eq!(key2.get().unwrap().as_slice(), "data");
575566
}
576567

@@ -605,23 +596,6 @@ mod test {
605596
assert!(rx.recv() == 10);
606597
}
607598

608-
#[test]
609-
fn heap_cycles() {
610-
use std::cell::RefCell;
611-
612-
struct List {
613-
next: Option<Gc<RefCell<List>>>,
614-
}
615-
616-
let a = box(GC) RefCell::new(List { next: None });
617-
let b = box(GC) RefCell::new(List { next: Some(a) });
618-
619-
{
620-
let mut a = a.borrow_mut();
621-
a.next = Some(b);
622-
}
623-
}
624-
625599
#[test]
626600
#[should_fail]
627601
fn test_begin_unwind() {

src/test/auxiliary/cci_nested_lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111

1212
use std::cell::RefCell;
13-
use std::gc::{Gc, GC};
1413

1514
pub struct Entry<A,B> {
1615
key: A,
@@ -19,7 +18,7 @@ pub struct Entry<A,B> {
1918

2019
pub struct alist<A,B> {
2120
eq_fn: extern "Rust" fn(A,A) -> bool,
22-
data: Gc<RefCell<Vec<Entry<A,B>>>>,
21+
data: Box<RefCell<Vec<Entry<A,B>>>>,
2322
}
2423

2524
pub fn alist_add<A:'static,B:'static>(lst: &alist<A,B>, k: A, v: B) {
@@ -47,7 +46,7 @@ pub fn new_int_alist<B:'static>() -> alist<int, B> {
4746
fn eq_int(a: int, b: int) -> bool { a == b }
4847
return alist {
4948
eq_fn: eq_int,
50-
data: box(GC) RefCell::new(Vec::new()),
49+
data: box RefCell::new(Vec::new()),
5150
};
5251
}
5352

@@ -57,6 +56,6 @@ pub fn new_int_alist_2<B:'static>() -> alist<int, B> {
5756
fn eq_int(a: int, b: int) -> bool { a == b }
5857
return alist {
5958
eq_fn: eq_int,
60-
data: box(GC) RefCell::new(Vec::new()),
59+
data: box RefCell::new(Vec::new()),
6160
};
6261
}

src/test/auxiliary/crate-method-reexport-grrrrrrr2.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ pub mod name_pool {
2727

2828
pub mod rust {
2929
pub use name_pool::add;
30-
use std::gc::Gc;
3130

32-
pub type rt = Gc<()>;
31+
pub type rt = Box<()>;
3332

3433
pub trait cx {
3534
fn cx(&self);

src/test/auxiliary/issue-2631-a.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
use std::cell::RefCell;
1515
use std::collections::HashMap;
16-
use std::gc::Gc;
16+
use std::rc::Rc;
1717

18-
pub type header_map = HashMap<String, Gc<RefCell<Vec<Gc<String>>>>>;
18+
pub type header_map = HashMap<String, Rc<RefCell<Vec<Rc<String>>>>>;
1919

2020
// the unused ty param is necessary so this gets monomorphized
2121
pub fn request<T>(req: &header_map) {

src/test/auxiliary/issue-5521.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111

1212
use std::collections::HashMap;
13-
use std::gc::Gc;
1413

15-
pub type map = Gc<HashMap<uint, uint>>;
14+
pub type map = Box<HashMap<uint, uint>>;
1615

src/test/auxiliary/issue13507.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ pub mod testtypes {
5656
VarB(uint, uint)
5757
}
5858

59-
// Skipping ty_box
60-
6159
// Tests ty_uniq (of u8)
6260
pub type FooUniq = Box<u8>;
6361

src/test/bench/task-perf-alloc-unwind.rs

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,15 @@
1010

1111
#![feature(unsafe_destructor)]
1212

13-
extern crate collections;
1413
extern crate time;
1514

1615
use time::precise_time_s;
1716
use std::os;
1817
use std::task;
19-
use std::vec;
20-
use std::gc::{Gc, GC};
2118

2219
#[deriving(Clone)]
2320
enum List<T> {
24-
Nil, Cons(T, Gc<List<T>>)
21+
Nil, Cons(T, Box<List<T>>)
2522
}
2623

2724
enum UniqueList {
@@ -53,23 +50,21 @@ type nillist = List<()>;
5350
// Filled with things that have to be unwound
5451

5552
struct State {
56-
managed: Gc<nillist>,
5753
unique: Box<nillist>,
58-
tuple: (Gc<nillist>, Box<nillist>),
59-
vec: Vec<Gc<nillist>>,
54+
vec: Vec<Box<nillist>>,
6055
res: r
6156
}
6257

6358
struct r {
64-
_l: Gc<nillist>,
59+
_l: Box<nillist>,
6560
}
6661

6762
#[unsafe_destructor]
6863
impl Drop for r {
6964
fn drop(&mut self) {}
7065
}
7166

72-
fn r(l: Gc<nillist>) -> r {
67+
fn r(l: Box<nillist>) -> r {
7368
r {
7469
_l: l
7570
}
@@ -85,22 +80,17 @@ fn recurse_or_fail(depth: int, st: Option<State>) {
8580
let st = match st {
8681
None => {
8782
State {
88-
managed: box(GC) Nil,
8983
unique: box Nil,
90-
tuple: (box(GC) Nil, box Nil),
91-
vec: vec!(box(GC) Nil),
92-
res: r(box(GC) Nil)
84+
vec: vec!(box Nil),
85+
res: r(box Nil)
9386
}
9487
}
9588
Some(st) => {
9689
State {
97-
managed: box(GC) Cons((), st.managed),
98-
unique: box Cons((), box(GC) *st.unique),
99-
tuple: (box(GC) Cons((), st.tuple.ref0().clone()),
100-
box Cons((), box(GC) *st.tuple.ref1().clone())),
90+
unique: box Cons((), box *st.unique),
10191
vec: st.vec.clone().append(
102-
&[box(GC) Cons((), *st.vec.last().unwrap())]),
103-
res: r(box(GC) Cons((), st.res._l))
92+
&[box Cons((), *st.vec.last().unwrap())]),
93+
res: r(box Cons((), st.res._l))
10494
}
10595
}
10696
};

0 commit comments

Comments
 (0)