diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2014-06-23 12:52:28 -0400 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-06-24 17:19:17 -0700 |
| commit | d58412bfa13a21718c629407939d08b8fca2edc7 (patch) | |
| tree | d4faed43b276ef01bb9daf9795823976f3ae2d2b /src | |
| parent | 9e3d0b002a5c2e81d43351c9b8550a3f4ccfb8f9 (diff) | |
| download | rust-d58412bfa13a21718c629407939d08b8fca2edc7.tar.gz rust-d58412bfa13a21718c629407939d08b8fca2edc7.zip | |
Add more description to c_str::unwrap().
It's unclear what you are supposed to do with this memory. Let's make that more clear.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustrt/c_str.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/librustrt/c_str.rs b/src/librustrt/c_str.rs index 4a7ac97beed..10d1594e78e 100644 --- a/src/librustrt/c_str.rs +++ b/src/librustrt/c_str.rs @@ -123,7 +123,10 @@ impl CString { } /// Unwraps the wrapped `*libc::c_char` from the `CString` wrapper. - /// Any ownership of the buffer by the `CString` wrapper is forgotten. + /// + /// The original object is destructed after this method is called, and if + /// the underlying pointer was previously allocated, care must be taken to + /// ensure that it is deallocated properly. pub unsafe fn unwrap(self) -> *libc::c_char { let mut c_str = self; c_str.owns_buffer_ = false; |
