From 566dc9cf9377457e4d099d3306c30014ad582963 Mon Sep 17 00:00:00 2001 From: Cristian Kubis Date: Thu, 1 Oct 2015 12:43:00 +0200 Subject: [PATCH 1/2] doc: fixed swapped docs for from_ptr and from_raw --- src/libstd/ffi/c_str.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 7c9c2066ae93a..70e9eca31e56b 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -230,11 +230,11 @@ impl CString { /// Transfers ownership of the string to a C caller. /// /// The pointer must be returned to Rust and reconstituted using - /// `from_raw` to be properly deallocated. Specifically, one + /// `from_ptr` to be properly deallocated. Specifically, one /// should *not* use the standard C `free` function to deallocate /// this string. /// - /// Failure to call `from_raw` will lead to a memory leak. + /// Failure to call `from_ptr` will lead to a memory leak. #[unstable(feature = "cstr_memory2", reason = "recently added", issue = "27769")] #[deprecated(since = "1.4.0", reason = "renamed to into_raw")] @@ -245,11 +245,11 @@ impl CString { /// Transfers ownership of the string to a C caller. /// /// The pointer must be returned to Rust and reconstituted using - /// `from_ptr` to be properly deallocated. Specifically, one + /// `from_raw` to be properly deallocated. Specifically, one /// should *not* use the standard C `free` function to deallocate /// this string. /// - /// Failure to call `from_ptr` will lead to a memory leak. + /// Failure to call `from_raw` will lead to a memory leak. #[stable(feature = "cstr_memory", since = "1.4.0")] pub fn into_raw(self) -> *mut libc::c_char { Box::into_raw(self.inner) as *mut libc::c_char From 25c21342c62cf92d709ea3df493cfbb3718e5d0c Mon Sep 17 00:00:00 2001 From: Cristian Kubis Date: Thu, 1 Oct 2015 16:02:35 +0200 Subject: [PATCH 2/2] replaced *_ptr with *_raw methods in docs --- src/libstd/ffi/c_str.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 70e9eca31e56b..6b7ecaa77d10f 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -206,7 +206,7 @@ impl CString { /// Retakes ownership of a CString that was transferred to C. /// /// The only appropriate argument is a pointer obtained by calling - /// `into_ptr`. The length of the string will be recalculated + /// `into_raw`. The length of the string will be recalculated /// using the pointer. #[unstable(feature = "cstr_memory2", reason = "recently added", issue = "27769")] @@ -230,11 +230,11 @@ impl CString { /// Transfers ownership of the string to a C caller. /// /// The pointer must be returned to Rust and reconstituted using - /// `from_ptr` to be properly deallocated. Specifically, one + /// `from_raw` to be properly deallocated. Specifically, one /// should *not* use the standard C `free` function to deallocate /// this string. /// - /// Failure to call `from_ptr` will lead to a memory leak. + /// Failure to call `from_raw` will lead to a memory leak. #[unstable(feature = "cstr_memory2", reason = "recently added", issue = "27769")] #[deprecated(since = "1.4.0", reason = "renamed to into_raw")]