From bf3d40aa7e6a1d95536a406b3fd4743a26cdc758 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Wed, 17 Oct 2018 09:11:55 +0200 Subject: [PATCH] Update TypedArena tests --- src/libarena/lib.rs | 22 +++++++++---------- .../dropck_tarena_cycle_checked.rs | 2 +- .../dropck_tarena_unsound_drop.rs | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index a7b34b6dc40..dae05a368fa 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -500,7 +500,7 @@ struct Point { #[test] pub fn test_unused() { - let arena: TypedArena = TypedArena::new(); + let arena: TypedArena = TypedArena::default(); assert!(arena.chunks.borrow().is_empty()); } @@ -538,7 +538,7 @@ fn alloc_outer 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 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 = TypedArena::new(); + let arena: TypedArena = 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 = TypedArena::new(); + let mut arena: TypedArena = 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 = TypedArena::new(); + let arena: TypedArena = 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(), diff --git a/src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs b/src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs index f368788af55..5ab6b99eb62 100644 --- a/src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs +++ b/src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs @@ -122,6 +122,6 @@ fn f<'a>(arena: &'a TypedArena>) { } fn main() { - let arena = TypedArena::new(); + let arena = TypedArena::default(); f(&arena); } //~^ ERROR `arena` does not live long enough diff --git a/src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs b/src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs index 531e1ada44b..e2231b0814f 100644 --- a/src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs +++ b/src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs @@ -47,7 +47,7 @@ impl<'a> HasId for &'a usize { fn count(&self) -> usize { 1 } } fn f<'a>(_arena: &'a TypedArena>) {} fn main() { - let arena: TypedArena = TypedArena::new(); + let arena: TypedArena = TypedArena::default(); f(&arena); } //~^ ERROR `arena` does not live long enough -- 2.44.0