{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/47975","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/47975/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/47975/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/47975/events","html_url":"https://github.com/rust-lang/rust/pull/47975","id":294030239,"number":47975,"title":"Add safe volatile functions.","user":{"login":"clarcharr","id":15850505,"avatar_url":"https://avatars1.githubusercontent.com/u/15850505?v=4","gravatar_id":"","url":"https://api.github.com/users/clarcharr","html_url":"https://github.com/clarcharr","followers_url":"https://api.github.com/users/clarcharr/followers","following_url":"https://api.github.com/users/clarcharr/following{/other_user}","gists_url":"https://api.github.com/users/clarcharr/gists{/gist_id}","starred_url":"https://api.github.com/users/clarcharr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clarcharr/subscriptions","organizations_url":"https://api.github.com/users/clarcharr/orgs","repos_url":"https://api.github.com/users/clarcharr/repos","events_url":"https://api.github.com/users/clarcharr/events{/privacy}","received_events_url":"https://api.github.com/users/clarcharr/received_events","type":"User","site_admin":false},"labels":[{"id":583426710,"url":"https://api.github.com/repos/rust-lang/rust/labels/S-waiting-on-review","name":"S-waiting-on-review","color":"d3dddd","default":false}],"state":"open","locked":false,"assignee":{"login":"alexcrichton","id":64996,"avatar_url":"https://avatars1.githubusercontent.com/u/64996?v=4","gravatar_id":"","url":"https://api.github.com/users/alexcrichton","html_url":"https://github.com/alexcrichton","followers_url":"https://api.github.com/users/alexcrichton/followers","following_url":"https://api.github.com/users/alexcrichton/following{/other_user}","gists_url":"https://api.github.com/users/alexcrichton/gists{/gist_id}","starred_url":"https://api.github.com/users/alexcrichton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexcrichton/subscriptions","organizations_url":"https://api.github.com/users/alexcrichton/orgs","repos_url":"https://api.github.com/users/alexcrichton/repos","events_url":"https://api.github.com/users/alexcrichton/events{/privacy}","received_events_url":"https://api.github.com/users/alexcrichton/received_events","type":"User","site_admin":false},"assignees":[{"login":"alexcrichton","id":64996,"avatar_url":"https://avatars1.githubusercontent.com/u/64996?v=4","gravatar_id":"","url":"https://api.github.com/users/alexcrichton","html_url":"https://github.com/alexcrichton","followers_url":"https://api.github.com/users/alexcrichton/followers","following_url":"https://api.github.com/users/alexcrichton/following{/other_user}","gists_url":"https://api.github.com/users/alexcrichton/gists{/gist_id}","starred_url":"https://api.github.com/users/alexcrichton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexcrichton/subscriptions","organizations_url":"https://api.github.com/users/alexcrichton/orgs","repos_url":"https://api.github.com/users/alexcrichton/repos","events_url":"https://api.github.com/users/alexcrichton/events{/privacy}","received_events_url":"https://api.github.com/users/alexcrichton/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2018-02-02T21:34:08Z","updated_at":"2018-02-03T04:18:09Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/47975","html_url":"https://github.com/rust-lang/rust/pull/47975","diff_url":"https://github.com/rust-lang/rust/pull/47975.diff","patch_url":"https://github.com/rust-lang/rust/pull/47975.patch"},"body":"This adds safe equivalents of `read_volatile` and `write_volatile` to `std::mem`, using references instead of pointers.\r\n\r\nThe `move_opaque` and `drop_opaque` functions are the `value_fence` and `compute_and_drop` mentioned in [rust-lang/rfcs#1484 (comment)](https://github.com/rust-lang/rfcs/issues/1484#issuecomment-362672337). `move_opaque` is roughly equivalent to the unstable `test::black_box`.\r\n\r\n`copy_opaque` and `replace_opaque` are added for completeness, as they are useful equivalents `read_volatile` and `write_volatile` that will work in most cases. This means that volatile reads and writes don't have to be annotated with `unsafe` on each occurrence, and that the programmer simply has to verify that the pointers are correct and cast them to references (probably with `'static` lifetime).\r\n\r\nIf an RFC is required to add these, I'd be willing to write one. However, I think they're reasonable enough to have a PR for now."},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/362778324","html_url":"https://github.com/rust-lang/rust/pull/47975#issuecomment-362778324","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/47975","id":362778324,"user":{"login":"clarcharr","id":15850505,"avatar_url":"https://avatars1.githubusercontent.com/u/15850505?v=4","gravatar_id":"","url":"https://api.github.com/users/clarcharr","html_url":"https://github.com/clarcharr","followers_url":"https://api.github.com/users/clarcharr/followers","following_url":"https://api.github.com/users/clarcharr/following{/other_user}","gists_url":"https://api.github.com/users/clarcharr/gists{/gist_id}","starred_url":"https://api.github.com/users/clarcharr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clarcharr/subscriptions","organizations_url":"https://api.github.com/users/clarcharr/orgs","repos_url":"https://api.github.com/users/clarcharr/repos","events_url":"https://api.github.com/users/clarcharr/events{/privacy}","received_events_url":"https://api.github.com/users/clarcharr/received_events","type":"User","site_admin":false},"created_at":"2018-02-03T04:18:09Z","updated_at":"2018-02-03T04:18:09Z","author_association":"CONTRIBUTOR","body":"@cramerj I see `&T` as guaranteeing that nothing in the same program has modified the value; that doesn't necessarily guarantee that the value wasn't changed. Plus, types like `Cell` break this guarantee through an API not unlike `copy_opaque`."}}
{"actor":{"display_login":"clarcharr"}}