Skip to content

Commit 6382baa

Browse files
committed
Use ptr::write to initialize uninitalized memory, NOT mem::replace
1 parent 77eb73a commit 6382baa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ where
120120
ffi::lua_pop(state, 1);
121121

122122
let function = mem::replace(&mut (*params).function, mem::uninitialized());
123-
mem::replace(&mut (*params).result, function(state));
123+
ptr::write(&mut (*params).result, function(state));
124124
// params now has function uninitialied and result initialized
125125

126126
if (*params).nresults == ffi::LUA_MULTRET {

0 commit comments

Comments
 (0)