about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2011-09-29 18:36:27 -0700
committerPatrick Walton <pcwalton@mimiga.net>2011-09-29 18:36:27 -0700
commit5b6dbcb0303c99c29bb8579abff7cee50befeb6c (patch)
tree50ad15d769fe5b39f71f180a9564f5d45671834e /src
parent3be6cf7ab24ec496443a6fa4cb14cd463cf2f587 (diff)
downloadrust-5b6dbcb0303c99c29bb8579abff7cee50befeb6c.tar.gz
rust-5b6dbcb0303c99c29bb8579abff7cee50befeb6c.zip
stdlib: Un-export str::buf; add a comment
Diffstat (limited to 'src')
-rw-r--r--src/lib/str.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/str.rs b/src/lib/str.rs
index ffc5d24a74a..39e905f8c96 100644
--- a/src/lib/str.rs
+++ b/src/lib/str.rs
@@ -4,8 +4,7 @@ export eq, lteq, hash, is_empty, is_not_empty, is_whitespace, byte_len, index,
        unshift_char, shift_char, pop_char, push_char, is_utf8, from_chars,
        to_chars, char_len, char_at, bytes, is_ascii, shift_byte, pop_byte,
        unsafe_from_byte, unsafe_from_bytes, from_char, char_range_at,
-       str_from_cstr, sbuf, as_buf, push_byte, utf8_char_width, safe_slice,
-       buf;
+       str_from_cstr, sbuf, as_buf, push_byte, utf8_char_width, safe_slice;
 
 native "rust" mod rustrt {
     fn rust_str_push(&s: str, ch: u8);
@@ -420,6 +419,8 @@ fn trim(s: str) -> str { trim_left(trim_right(s)) }
 
 type sbuf = *u8;
 
+// NB: This is intentionally unexported because it's easy to misuse (there's
+// no guarantee that the string is rooted). Instead, use as_buf below.
 fn buf(s: str) -> sbuf {
     let saddr = ptr::addr_of(s);
     let vaddr: *[u8] = unsafe::reinterpret_cast(saddr);