Skip to content

Commit 755fd29

Browse files
committed
Fix mutability error in CString::from_raw
1 parent 6d14512 commit 755fd29

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libstd/ffi/c_str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ impl CString {
311311
#[stable(feature = "cstr_memory", since = "1.4.0")]
312312
pub unsafe fn from_raw(ptr: *mut c_char) -> CString {
313313
let len = libc::strlen(ptr) + 1; // Including the NUL byte
314-
let slice = slice::from_raw_parts(ptr, len as usize);
314+
let slice = slice::from_raw_parts_mut(ptr, len as usize);
315315
CString { inner: Box::from_raw(slice as *mut [c_char] as *mut [u8]) }
316316
}
317317

0 commit comments

Comments
 (0)