We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d6257b3 commit 72688eaCopy full SHA for 72688ea
src/libstd/c_str.rs
@@ -29,7 +29,7 @@ pub struct CString {
29
30
impl CString {
31
/// Create a C String from a pointer.
32
- pub fn new(buf: *libc::c_char, owns_buffer: bool) -> CString {
+ pub unsafe fn new(buf: *libc::c_char, owns_buffer: bool) -> CString {
33
CString { buf: buf, owns_buffer_: owns_buffer }
34
}
35
@@ -187,7 +187,7 @@ mod tests {
187
188
#[test]
189
fn test_is_null() {
190
- let c_str = CString::new(ptr::null(), false);
+ let c_str = unsafe { CString::new(ptr::null(), false) };
191
assert!(c_str.is_null());
192
assert!(!c_str.is_not_null());
193
0 commit comments