diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-06-11 19:33:52 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-06-14 10:45:37 -0700 |
| commit | ade807c6dcf6dc4454732c5e914ca06ebb429773 (patch) | |
| tree | 64606dac9c81ec4567e19f503d4d82e249dbf40a /src/librustrt | |
| parent | f20b1293fcce4e120bd4a57226e0817271cd672c (diff) | |
| download | rust-ade807c6dcf6dc4454732c5e914ca06ebb429773.tar.gz rust-ade807c6dcf6dc4454732c5e914ca06ebb429773.zip | |
rustc: Obsolete the `@` syntax entirely
This removes all remnants of `@` pointers from rustc. Additionally, this removes the `GC` structure from the prelude as it seems odd exporting an experimental type in the prelude by default. Closes #14193 [breaking-change]
Diffstat (limited to 'src/librustrt')
| -rw-r--r-- | src/librustrt/local_data.rs | 17 | ||||
| -rw-r--r-- | src/librustrt/local_heap.rs | 5 | ||||
| -rw-r--r-- | src/librustrt/task.rs | 17 |
3 files changed, 21 insertions, 18 deletions
diff --git a/src/librustrt/local_data.rs b/src/librustrt/local_data.rs index 1a7f0cdfc50..215c0992bc0 100644 --- a/src/librustrt/local_data.rs +++ b/src/librustrt/local_data.rs @@ -274,6 +274,7 @@ impl<T: 'static> Drop for Ref<T> { #[cfg(test)] mod tests { use std::prelude::*; + use std::gc::{Gc, GC}; use super::*; use std::task; @@ -329,11 +330,11 @@ mod tests { #[test] fn test_tls_multiple_types() { static str_key: Key<String> = &Key; - static box_key: Key<@()> = &Key; + static box_key: Key<Gc<()>> = &Key; static int_key: Key<int> = &Key; task::spawn(proc() { str_key.replace(Some("string data".to_string())); - box_key.replace(Some(@())); + box_key.replace(Some(box(GC) ())); int_key.replace(Some(42)); }); } @@ -341,13 +342,13 @@ mod tests { #[test] fn test_tls_overwrite_multiple_types() { static str_key: Key<String> = &Key; - static box_key: Key<@()> = &Key; + static box_key: Key<Gc<()>> = &Key; static int_key: Key<int> = &Key; task::spawn(proc() { str_key.replace(Some("string data".to_string())); str_key.replace(Some("string data 2".to_string())); - box_key.replace(Some(@())); - box_key.replace(Some(@())); + box_key.replace(Some(box(GC) ())); + box_key.replace(Some(box(GC) ())); int_key.replace(Some(42)); // This could cause a segfault if overwriting-destruction is done // with the crazy polymorphic transmute rather than the provided @@ -360,13 +361,13 @@ mod tests { #[should_fail] fn test_tls_cleanup_on_failure() { static str_key: Key<String> = &Key; - static box_key: Key<@()> = &Key; + static box_key: Key<Gc<()>> = &Key; static int_key: Key<int> = &Key; str_key.replace(Some("parent data".to_string())); - box_key.replace(Some(@())); + box_key.replace(Some(box(GC) ())); task::spawn(proc() { str_key.replace(Some("string data".to_string())); - box_key.replace(Some(@())); + box_key.replace(Some(box(GC) ())); int_key.replace(Some(42)); fail!(); }); diff --git a/src/librustrt/local_heap.rs b/src/librustrt/local_heap.rs index 52fe5c35a26..d09033e771c 100644 --- a/src/librustrt/local_heap.rs +++ b/src/librustrt/local_heap.rs @@ -317,14 +317,15 @@ pub unsafe fn local_free(ptr: *u8) { mod bench { extern crate test; use self::test::Bencher; + use std::gc::GC; #[bench] fn alloc_managed_small(b: &mut Bencher) { - b.iter(|| { @10; }); + b.iter(|| { box(GC) 10 }); } #[bench] fn alloc_managed_big(b: &mut Bencher) { - b.iter(|| { @([10, ..1000]); }); + b.iter(|| { box(GC) ([10, ..1000]) }); } } diff --git a/src/librustrt/task.rs b/src/librustrt/task.rs index bde14b962c7..e99703a1f58 100644 --- a/src/librustrt/task.rs +++ b/src/librustrt/task.rs @@ -397,10 +397,11 @@ mod test { use super::*; use std::prelude::*; use std::task; + use std::gc::{Gc, GC}; #[test] fn local_heap() { - let a = @5; + let a = box(GC) 5; let b = a; assert!(*a == 5); assert!(*b == 5); @@ -408,11 +409,11 @@ mod test { #[test] fn tls() { - local_data_key!(key: @String) - key.replace(Some(@"data".to_string())); + local_data_key!(key: Gc<String>) + key.replace(Some(box(GC) "data".to_string())); assert_eq!(key.get().unwrap().as_slice(), "data"); - local_data_key!(key2: @String) - key2.replace(Some(@"data".to_string())); + local_data_key!(key2: Gc<String>) + key2.replace(Some(box(GC) "data".to_string())); assert_eq!(key2.get().unwrap().as_slice(), "data"); } @@ -452,11 +453,11 @@ mod test { use std::cell::RefCell; struct List { - next: Option<@RefCell<List>>, + next: Option<Gc<RefCell<List>>>, } - let a = @RefCell::new(List { next: None }); - let b = @RefCell::new(List { next: Some(a) }); + let a = box(GC) RefCell::new(List { next: None }); + let b = box(GC) RefCell::new(List { next: Some(a) }); { let mut a = a.borrow_mut(); |
