about summary refs log tree commit diff
path: root/library/alloc/src/string.rs
diff options
context:
space:
mode:
authorYoshua Wuyts <yoshuawuyts@gmail.com>2020-11-20 15:25:43 +0100
committerYoshua Wuyts <yoshuawuyts@gmail.com>2021-01-22 18:15:28 +0100
commit7d102383f97c1616cffce5ca72ff12eabd9603bf (patch)
treee693cfad89c88181d4269c71a2a491ec5dafbe6a /library/alloc/src/string.rs
parentbbc01bb624a960533e049fdb98d0489ff2a8de06 (diff)
downloadrust-7d102383f97c1616cffce5ca72ff12eabd9603bf.tar.gz
rust-7d102383f97c1616cffce5ca72ff12eabd9603bf.zip
Add doc aliases for memory allocations
- Vec::with_capacity / Box::new -> alloc + malloc
- Box::new_zeroed -> calloc
- Vec::{reserve,reserve_exact,try_reserve_exact,shrink_to_fit,shrink_to} -> realloc
Diffstat (limited to 'library/alloc/src/string.rs')
-rw-r--r--library/alloc/src/string.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs
index 6f2a497598d..b1f860d6b64 100644
--- a/library/alloc/src/string.rs
+++ b/library/alloc/src/string.rs
@@ -403,6 +403,8 @@ impl String {
     /// s.push('a');
     /// ```
     #[inline]
+    #[doc(alias = "alloc")]
+    #[doc(alias = "malloc")]
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn with_capacity(capacity: usize) -> String {
         String { vec: Vec::with_capacity(capacity) }