From 8b60fe99ec7d52cf6de435d1414ea968105c11d4 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Thu, 25 Jun 2015 13:45:52 +0530 Subject: [PATCH 1/3] The Unsafe English Language demands tribute --- vec.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vec.md b/vec.md index 9f7250c951af..31cc70a91391 100644 --- a/vec.md +++ b/vec.md @@ -253,7 +253,7 @@ pub fn pop(&mut self) -> Option { # Deallocating -Next we should implement Drop so that we don't massively leaks tons of resources. +Next we should implement Drop so that we don't massively leak tons of resources. The easiest way is to just call `pop` until it yields None, and then deallocate our buffer. Note that calling `pop` is uneeded if `T: !Drop`. In theory we can ask Rust if T needs_drop and omit the calls to `pop`. However in practice LLVM From 3f6692874fdac72a7d0cbf578ed096ca8d0cbd1d Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Thu, 25 Jun 2015 13:47:04 +0530 Subject: [PATCH 2/3] lowercase level Virtual Machine --- vec.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vec.md b/vec.md index 31cc70a91391..fd69e4b262ba 100644 --- a/vec.md +++ b/vec.md @@ -442,7 +442,7 @@ end = ptr.offset(len) ``` However because `offset` is marked as a GEP inbounds instruction, this will tell -llVM that ptr is allocated and won't alias other allocated memory. This is fine +LLVM that ptr is allocated and won't alias other allocated memory. This is fine for zero-sized types, as they can't alias anything. However if we're using heap::EMPTY as a sentinel for a non-allocation for a *non-zero-sized* type, this can cause undefined behaviour. Alas, we must therefore special case either From 414f7301978b7d84c12bdbd46242daae254e963d Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Thu, 25 Jun 2015 13:53:05 +0530 Subject: [PATCH 3/3] If you prick a code block, does it not bleed? --- vec.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vec.md b/vec.md index fd69e4b262ba..94bc65fcac08 100644 --- a/vec.md +++ b/vec.md @@ -444,7 +444,7 @@ end = ptr.offset(len) However because `offset` is marked as a GEP inbounds instruction, this will tell LLVM that ptr is allocated and won't alias other allocated memory. This is fine for zero-sized types, as they can't alias anything. However if we're using -heap::EMPTY as a sentinel for a non-allocation for a *non-zero-sized* type, +`heap::EMPTY` as a sentinel for a non-allocation for a *non-zero-sized* type, this can cause undefined behaviour. Alas, we must therefore special case either cap or len being 0 to not do the offset.