{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rfcs/issues/1304","labels_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1304/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1304/comments","events_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1304/events","html_url":"https://github.com/rust-lang/rfcs/issues/1304","id":109592342,"number":1304,"title":"`mem::write`, a safe `ptr::write`","user":{"login":"reem","id":4745181,"avatar_url":"https://avatars.githubusercontent.com/u/4745181?v=3","gravatar_id":"","url":"https://api.github.com/users/reem","html_url":"https://github.com/reem","followers_url":"https://api.github.com/users/reem/followers","following_url":"https://api.github.com/users/reem/following{/other_user}","gists_url":"https://api.github.com/users/reem/gists{/gist_id}","starred_url":"https://api.github.com/users/reem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reem/subscriptions","organizations_url":"https://api.github.com/users/reem/orgs","repos_url":"https://api.github.com/users/reem/repos","events_url":"https://api.github.com/users/reem/events{/privacy}","received_events_url":"https://api.github.com/users/reem/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-03T00:11:28Z","updated_at":"2015-10-03T00:29:05Z","closed_at":null,"body":"Now that `mem::forget` is safe, it would be useful to have a function like:\r\n\r\n```rust\r\npub fn write<T>(target: &mut T, value: T) {\r\n    unsafe { ptr::write(target, value) }\r\n}\r\n```\r\n\r\nprobably in `std::mem`, alongside `swap` and `replace`."},"comment":{"url":"https://api.github.com/repos/rust-lang/rfcs/issues/comments/145188373","html_url":"https://github.com/rust-lang/rfcs/issues/1304#issuecomment-145188373","issue_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1304","id":145188373,"user":{"login":"bluss","id":3209739,"avatar_url":"https://avatars.githubusercontent.com/u/3209739?v=3","gravatar_id":"","url":"https://api.github.com/users/bluss","html_url":"https://github.com/bluss","followers_url":"https://api.github.com/users/bluss/followers","following_url":"https://api.github.com/users/bluss/following{/other_user}","gists_url":"https://api.github.com/users/bluss/gists{/gist_id}","starred_url":"https://api.github.com/users/bluss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluss/subscriptions","organizations_url":"https://api.github.com/users/bluss/orgs","repos_url":"https://api.github.com/users/bluss/repos","events_url":"https://api.github.com/users/bluss/events{/privacy}","received_events_url":"https://api.github.com/users/bluss/received_events","type":"User","site_admin":false},"created_at":"2015-10-03T00:29:05Z","updated_at":"2015-10-03T00:29:05Z","body":"docs for ptr::write are not up to date: “Beyond accepting a raw pointer, this operation is unsafe because it does not drop the contents of dst.”"}}