From 31cdac9aea8e9d319d3c30479c687b1665e37e16 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Mon, 23 Jun 2014 12:52:28 -0400 Subject: [PATCH] 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. --- src/librustrt/c_str.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/librustrt/c_str.rs b/src/librustrt/c_str.rs index 4a7ac97beed8d..10d1594e78e04 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;