Skip to content

Commit 78da21c

Browse files
authored
Make Vec::new public in vec-alloc.md (#336)
1 parent 98a2ca0 commit 78da21c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Diff for: src/vec/vec-alloc.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ So:
2222
use std::mem;
2323
2424
impl<T> Vec<T> {
25-
fn new() -> Self {
25+
pub fn new() -> Self {
2626
assert!(mem::size_of::<T>() != 0, "We're not ready to handle ZSTs");
2727
Vec {
2828
ptr: NonNull::dangling(),
@@ -39,11 +39,11 @@ I slipped in that assert there because zero-sized types will require some
3939
special handling throughout our code, and I want to defer the issue for now.
4040
Without this assert, some of our early drafts will do some Very Bad Things.
4141

42-
Next we need to figure out what to actually do when we *do* want space. For that,
43-
we use the global allocation functions [`alloc`][alloc], [`realloc`][realloc],
44-
and [`dealloc`][dealloc] which are available in stable Rust in
45-
[`std::alloc`][std_alloc]. These functions are expected to become deprecated in
46-
favor of the methods of [`std::alloc::Global`][Global] after this type is stabilized.
42+
Next we need to figure out what to actually do when we *do* want space. For that,
43+
we use the global allocation functions [`alloc`][alloc], [`realloc`][realloc],
44+
and [`dealloc`][dealloc] which are available in stable Rust in
45+
[`std::alloc`][std_alloc]. These functions are expected to become deprecated in
46+
favor of the methods of [`std::alloc::Global`][Global] after this type is stabilized.
4747

4848
We'll also need a way to handle out-of-memory (OOM) conditions. The standard
4949
library provides a function [`alloc::handle_alloc_error`][handle_alloc_error],

0 commit comments

Comments
 (0)