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 e053bff commit d6257b3Copy full SHA for d6257b3
src/libstd/c_str.rs
@@ -57,7 +57,7 @@ impl CString {
57
/// Fails if the CString is null.
58
pub fn with_mut_ref<T>(&mut self, f: &fn(*mut libc::c_char) -> T) -> T {
59
if self.buf.is_null() { fail!("CString is null!"); }
60
- f(unsafe { cast::transmute(self.buf) })
+ f(unsafe { cast::transmute_mut_unsafe(self.buf) })
61
}
62
63
/// Returns true if the CString is a null.
@@ -99,7 +99,7 @@ impl CString {
99
100
impl Drop for CString {
101
fn drop(&self) {
102
- if self.owns_buffer_ && self.buf.is_not_null() {
+ if self.owns_buffer_ {
103
unsafe {
104
libc::free(self.buf as *libc::c_void)
105
0 commit comments