From af453a33cc4ec8773ce869c4564d713a7ba60775 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 20 Jun 2013 15:27:10 -0400 Subject: This assert does not necessarily hold; sometimes we temporarily increase ref-count --- src/rt/boxed_region.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/rt') diff --git a/src/rt/boxed_region.cpp b/src/rt/boxed_region.cpp index a49b52bffe1..533a2a04755 100644 --- a/src/rt/boxed_region.cpp +++ b/src/rt/boxed_region.cpp @@ -40,8 +40,8 @@ rust_opaque_box *boxed_region::realloc(rust_opaque_box *box, size_t new_size) { // We also get called on the unique-vec-in-managed-heap path. - assert(box->ref_count == 1 || - box->ref_count == (size_t)(-2)); + // assert(box->ref_count == 1 || + // box->ref_count == (size_t)(-2)); size_t total_size = new_size + sizeof(rust_opaque_box); rust_opaque_box *new_box = -- cgit 1.4.1-3-g733a5 From 59083d2c6aedcbab469e263850c717cd958c24e6 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Fri, 21 Jun 2013 05:56:35 -0400 Subject: Address nits by @catamorphism --- src/libstd/ptr.rs | 2 +- src/rt/boxed_region.cpp | 4 ---- ...borrowck-wg-autoderef-and-autoborrowvec-combined-issue-6272.rs | 8 ++++---- 3 files changed, 5 insertions(+), 9 deletions(-) (limited to 'src/rt') diff --git a/src/libstd/ptr.rs b/src/libstd/ptr.rs index add2bbd7d44..2b42c085009 100644 --- a/src/libstd/ptr.rs +++ b/src/libstd/ptr.rs @@ -143,7 +143,7 @@ pub unsafe fn set_memory(dst: *mut T, c: u8, count: uint) { } /** - * Zeroes out `count` bytes of memory at `dst` + * Zeroes out `count * size_of::` bytes of memory at `dst` */ #[inline] #[cfg(not(stage0))] diff --git a/src/rt/boxed_region.cpp b/src/rt/boxed_region.cpp index 533a2a04755..012333b931e 100644 --- a/src/rt/boxed_region.cpp +++ b/src/rt/boxed_region.cpp @@ -39,10 +39,6 @@ rust_opaque_box *boxed_region::malloc(type_desc *td, size_t body_size) { rust_opaque_box *boxed_region::realloc(rust_opaque_box *box, size_t new_size) { - // We also get called on the unique-vec-in-managed-heap path. - // assert(box->ref_count == 1 || - // box->ref_count == (size_t)(-2)); - size_t total_size = new_size + sizeof(rust_opaque_box); rust_opaque_box *new_box = (rust_opaque_box*)backing_region->realloc(box, total_size); diff --git a/src/test/run-pass/borrowck-wg-autoderef-and-autoborrowvec-combined-issue-6272.rs b/src/test/run-pass/borrowck-wg-autoderef-and-autoborrowvec-combined-issue-6272.rs index c3432582647..5da7a6f2b56 100644 --- a/src/test/run-pass/borrowck-wg-autoderef-and-autoborrowvec-combined-issue-6272.rs +++ b/src/test/run-pass/borrowck-wg-autoderef-and-autoborrowvec-combined-issue-6272.rs @@ -29,13 +29,13 @@ fn main() { let a = @mut 3i; - // let b = @mut [a]; - // let c = @mut [3]; + let b = @mut [a]; + let c = @mut [3]; // this should freeze `a` only let _x: &mut int = a; // hence these writes should not fail: - // b[0] = b[0]; - // c[0] = c[0]; + b[0] = b[0]; + c[0] = c[0]; } -- cgit 1.4.1-3-g733a5