File tree Expand file tree Collapse file tree 3 files changed +7
-1
lines changed Expand file tree Collapse file tree 3 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,6 @@ refs/heads/tmp: e5d90d98402475b6e154ce216f9efcb80da1a747
29
29
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
30
30
refs/tags/homu-tmp: 1fe32ca12c51afcd761d9962f51a74ff0d07a591
31
31
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32
- refs/heads/stable: c9b40a30c0a8c5776920aec54039d0571e903f5a
32
+ refs/heads/stable: 913c2273eba32c7a33e068a5ac68007d7f8419d1
33
33
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
34
34
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
Original file line number Diff line number Diff line change @@ -124,6 +124,7 @@ impl<T : ?Sized> Box<T> {
124
124
#[ unstable( feature = "box_raw" ,
125
125
reason = "may be renamed or moved out of Box scope" ) ]
126
126
#[ inline]
127
+ // NB: may want to be called from_ptr, see comments on CStr::from_ptr
127
128
pub unsafe fn from_raw ( raw : * mut T ) -> Self {
128
129
mem:: transmute ( raw)
129
130
}
@@ -147,6 +148,7 @@ impl<T : ?Sized> Box<T> {
147
148
/// ```
148
149
#[ unstable( feature = "box_raw" , reason = "may be renamed" ) ]
149
150
#[ inline]
151
+ // NB: may want to be called into_ptr, see comments on CStr::from_ptr
150
152
pub fn into_raw ( b : Box < T > ) -> * mut T {
151
153
unsafe { mem:: transmute ( b) }
152
154
}
Original file line number Diff line number Diff line change @@ -206,6 +206,9 @@ impl CString {
206
206
/// `into_ptr`. The length of the string will be recalculated
207
207
/// using the pointer.
208
208
#[ unstable( feature = "cstr_memory" , reason = "recently added" ) ]
209
+ // NB: may want to be called from_raw, needs to consider CStr::from_ptr,
210
+ // Box::from_raw (or whatever it's currently called), and
211
+ // slice::from_raw_parts
209
212
pub unsafe fn from_ptr ( ptr : * const libc:: c_char ) -> CString {
210
213
let len = libc:: strlen ( ptr) + 1 ; // Including the NUL byte
211
214
let slice = slice:: from_raw_parts ( ptr, len as usize ) ;
@@ -221,6 +224,7 @@ impl CString {
221
224
///
222
225
/// Failure to call `from_ptr` will lead to a memory leak.
223
226
#[ unstable( feature = "cstr_memory" , reason = "recently added" ) ]
227
+ // NB: may want to be called into_raw, see comments on from_ptr
224
228
pub fn into_ptr ( self ) -> * const libc:: c_char {
225
229
// It is important that the bytes be sized to fit - we need
226
230
// the capacity to be determinable from the string length, and
You can’t perform that action at this time.
0 commit comments