]> git.lizzy.rs Git - rust.git/commitdiff
Update TypedArena tests
authorOliver Scherer <github35764891676564198441@oli-obk.de>
Wed, 17 Oct 2018 07:11:55 +0000 (09:11 +0200)
committerOliver Scherer <github35764891676564198441@oli-obk.de>
Fri, 19 Oct 2018 12:34:44 +0000 (14:34 +0200)
src/libarena/lib.rs
src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs
src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs

index a7b34b6dc40af87730b525efb6dafe0631b2e694..dae05a368fa0649391f713261b31a559ddd46951 100644 (file)
@@ -500,7 +500,7 @@ struct Point {
 
     #[test]
     pub fn test_unused() {
-        let arena: TypedArena<Point> = TypedArena::new();
+        let arena: TypedArena<Point> = TypedArena::default();
         assert!(arena.chunks.borrow().is_empty());
     }
 
@@ -538,7 +538,7 @@ fn alloc_outer<F: Fn() -> Outer<'a>>(&self, f: F) -> &Outer {
             }
         }
 
-        let arena = Wrap(TypedArena::new());
+        let arena = Wrap(TypedArena::default());
 
         let result = arena.alloc_outer(|| Outer {
             inner: arena.alloc_inner(|| Inner { value: 10 }),
@@ -549,7 +549,7 @@ fn alloc_outer<F: Fn() -> Outer<'a>>(&self, f: F) -> &Outer {
 
     #[test]
     pub fn test_copy() {
-        let arena = TypedArena::new();
+        let arena = TypedArena::default();
         for _ in 0..100000 {
             arena.alloc(Point { x: 1, y: 2, z: 3 });
         }
@@ -557,7 +557,7 @@ pub fn test_copy() {
 
     #[bench]
     pub fn bench_copy(b: &mut Bencher) {
-        let arena = TypedArena::new();
+        let arena = TypedArena::default();
         b.iter(|| arena.alloc(Point { x: 1, y: 2, z: 3 }))
     }
 
@@ -576,7 +576,7 @@ struct Noncopy {
 
     #[test]
     pub fn test_noncopy() {
-        let arena = TypedArena::new();
+        let arena = TypedArena::default();
         for _ in 0..100000 {
             arena.alloc(Noncopy {
                 string: "hello world".to_string(),
@@ -587,7 +587,7 @@ pub fn test_noncopy() {
 
     #[test]
     pub fn test_typed_arena_zero_sized() {
-        let arena = TypedArena::new();
+        let arena = TypedArena::default();
         for _ in 0..100000 {
             arena.alloc(());
         }
@@ -595,7 +595,7 @@ pub fn test_typed_arena_zero_sized() {
 
     #[test]
     pub fn test_typed_arena_clear() {
-        let mut arena = TypedArena::new();
+        let mut arena = TypedArena::default();
         for _ in 0..10 {
             arena.clear();
             for _ in 0..10000 {
@@ -620,7 +620,7 @@ fn drop(&mut self) {
     fn test_typed_arena_drop_count() {
         let counter = Cell::new(0);
         {
-            let arena: TypedArena<DropCounter> = TypedArena::new();
+            let arena: TypedArena<DropCounter> = TypedArena::default();
             for _ in 0..100 {
                 // Allocate something with drop glue to make sure it doesn't leak.
                 arena.alloc(DropCounter { count: &counter });
@@ -632,7 +632,7 @@ fn test_typed_arena_drop_count() {
     #[test]
     fn test_typed_arena_drop_on_clear() {
         let counter = Cell::new(0);
-        let mut arena: TypedArena<DropCounter> = TypedArena::new();
+        let mut arena: TypedArena<DropCounter> = TypedArena::default();
         for i in 0..10 {
             for _ in 0..100 {
                 // Allocate something with drop glue to make sure it doesn't leak.
@@ -659,7 +659,7 @@ fn drop(&mut self) {
     fn test_typed_arena_drop_small_count() {
         DROP_COUNTER.with(|c| c.set(0));
         {
-            let arena: TypedArena<SmallDroppable> = TypedArena::new();
+            let arena: TypedArena<SmallDroppable> = TypedArena::default();
             for _ in 0..100 {
                 // Allocate something with drop glue to make sure it doesn't leak.
                 arena.alloc(SmallDroppable);
@@ -671,7 +671,7 @@ fn test_typed_arena_drop_small_count() {
 
     #[bench]
     pub fn bench_noncopy(b: &mut Bencher) {
-        let arena = TypedArena::new();
+        let arena = TypedArena::default();
         b.iter(|| {
             arena.alloc(Noncopy {
                 string: "hello world".to_string(),
index f368788af55de50cb2f4830b18fb050f1420c6bd..5ab6b99eb62f95e194273f8c7f280151318cb7e6 100644 (file)
@@ -122,6 +122,6 @@ fn f<'a>(arena: &'a TypedArena<C<'a>>) {
 }
 
 fn main() {
-    let arena = TypedArena::new();
+    let arena = TypedArena::default();
     f(&arena);
 } //~^ ERROR `arena` does not live long enough
index 531e1ada44b3fd3f076d05f1d4726af9f78f9ba0..e2231b0814f3a75c803345c969be7e984909f68c 100644 (file)
@@ -47,7 +47,7 @@ impl<'a> HasId for &'a usize { fn count(&self) -> usize { 1 } }
 fn f<'a>(_arena: &'a TypedArena<C<'a>>) {}
 
 fn main() {
-    let arena: TypedArena<C> = TypedArena::new();
+    let arena: TypedArena<C> = TypedArena::default();
     f(&arena);
 } //~^ ERROR `arena` does not live long enough