{"action":"created","comment":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/comments/230907839","pull_request_review_id":171754492,"id":230907839,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMDkwNzgzOQ==","diff_hunk":"@@ -892,9 +907,14 @@ fn get_metadata_section_imp(target: &Target,\n             }\n         }\n         CrateFlavor::Rmeta => {\n-            let buf = fs::read(filename).map_err(|_|\n-                format!(\"failed to read rmeta metadata: '{}'\", filename.display()))?;\n-            rustc_erase_owner!(OwningRef::new(buf).map_owner_box())\n+            // mmap the file, because only a small fraction of it is read.\n+            let file = std::fs::File::open(filename).map_err(|_|\n+                format!(\"failed to open rmeta metadata: '{}'\", filename.display()))?;\n+            let mmap = unsafe { memmap::Mmap::map(&file) };","path":"src/librustc_metadata/locator.rs","position":45,"original_position":45,"commit_id":"39c5a8ac3a1b9e1df739e9ada21abd7a5097d9aa","original_commit_id":"39c5a8ac3a1b9e1df739e9ada21abd7a5097d9aa","user":{"login":"cramertj","id":5963049,"node_id":"MDQ6VXNlcjU5NjMwNDk=","avatar_url":"https://avatars1.githubusercontent.com/u/5963049?v=4","gravatar_id":"","url":"https://api.github.com/users/cramertj","html_url":"https://github.com/cramertj","followers_url":"https://api.github.com/users/cramertj/followers","following_url":"https://api.github.com/users/cramertj/following{/other_user}","gists_url":"https://api.github.com/users/cramertj/gists{/gist_id}","starred_url":"https://api.github.com/users/cramertj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cramertj/subscriptions","organizations_url":"https://api.github.com/users/cramertj/orgs","repos_url":"https://api.github.com/users/cramertj/repos","events_url":"https://api.github.com/users/cramertj/events{/privacy}","received_events_url":"https://api.github.com/users/cramertj/received_events","type":"User","site_admin":false},"body":"For what it's worth, we have a custom crate we use for this in fuchsia called `shared-buffer`, which does a volatile write of a pointer to the buffer in order to prove to LLVM that the memory has escaped, and then only access the memory using ptr reads/writes (`copy_nonoverlapping`), so as to avoid asserting that we have exclusive rights to access the memory. See the code and implementation notes [here](https://fuchsia.googlesource.com/garnet/+/master/public/rust/shared-buffer/src/lib.rs#5) (cc @joshlf).\r\n\r\nIt doesn't solve the SIGBUS / faulting case, though, which we handle through another mechanism (OS-supported snapshot).","created_at":"2018-11-05T20:54:08Z","updated_at":"2018-11-05T20:54:08Z","html_url":"https://github.com/rust-lang/rust/pull/55556#discussion_r230907839","pull_request_url":"https://api.github.com/repos/rust-lang/rust/pulls/55556","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/comments/230907839"},"html":{"href":"https://github.com/rust-lang/rust/pull/55556#discussion_r230907839"},"pull_request":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/55556"}},"in_reply_to_id":229915415},"pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/55556","id":227471725,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI3NDcxNzI1","html_url":"https://github.com/rust-lang/rust/pull/55556","diff_url":"https://github.com/rust-lang/rust/pull/55556.diff","patch_url":"https://github.com/rust-lang/rust/pull/55556.patch","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/55556","number":55556,"state":"open","locked":false,"title":"Use `Mmap` to open the rmeta file.","user":{"login":"nnethercote","id":1940286,"node_id":"MDQ6VXNlcjE5NDAyODY=","avatar_url":"https://avatars1.githubusercontent.com/u/1940286?v=4","gravatar_id":"","url":"https://api.github.com/users/nnethercote","html_url":"https://github.com/nnethercote","followers_url":"https://api.github.com/users/nnethercote/followers","following_url":"https://api.github.com/users/nnethercote/following{/other_user}","gists_url":"https://api.github.com/users/nnethercote/gists{/gist_id}","starred_url":"https://api.github.com/users/nnethercote/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nnethercote/subscriptions","organizations_url":"https://api.github.com/users/nnethercote/orgs","repos_url":"https://api.github.com/users/nnethercote/repos","events_url":"https://api.github.com/users/nnethercote/events{/privacy}","received_events_url":"https://api.github.com/users/nnethercote/received_events","type":"User","site_admin":false},"body":"Because those files are quite large, contribute significantly to peak\r\nmemory usage, but only a small fraction of the data is ever read.\r\n\r\nr? @eddyb ","created_at":"2018-10-31T23:27:04Z","updated_at":"2018-11-05T20:54:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9249bcf8eaa68adc6600350b0115cca0a6849d03","assignee":{"login":"alexcrichton","id":64996,"node_id":"MDQ6VXNlcjY0OTk2","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,"node_id":"MDQ6VXNlcjY0OTk2","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}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":583436937,"node_id":"MDU6TGFiZWw1ODM0MzY5Mzc=","url":"https://api.github.com/repos/rust-lang/rust/labels/S-waiting-on-author","name":"S-waiting-on-author","color":"d3dddd","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/rust-lang/rust/pulls/55556/commits","review_comments_url":"https://api.github.com/repos/rust-lang/rust/pulls/55556/comments","review_comment_url":"https://api.github.com/repos/rust-lang/rust/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/55556/comments","statuses_url":"https://api.github.com/repos/rust-lang/rust/statuses/39c5a8ac3a1b9e1df739e9ada21abd7a5097d9aa","head":{"label":"nnethercote:MmapMeta","ref":"MmapMeta","sha":"39c5a8ac3a1b9e1df739e9ada21abd7a5097d9aa","user":{"login":"nnethercote","id":1940286,"node_id":"MDQ6VXNlcjE5NDAyODY=","avatar_url":"https://avatars1.githubusercontent.com/u/1940286?v=4","gravatar_id":"","url":"https://api.github.com/users/nnethercote","html_url":"https://github.com/nnethercote","followers_url":"https://api.github.com/users/nnethercote/followers","following_url":"https://api.github.com/users/nnethercote/following{/other_user}","gists_url":"https://api.github.com/users/nnethercote/gists{/gist_id}","starred_url":"https://api.github.com/users/nnethercote/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nnethercote/subscriptions","organizations_url":"https://api.github.com/users/nnethercote/orgs","repos_url":"https://api.github.com/users/nnethercote/repos","events_url":"https://api.github.com/users/nnethercote/events{/privacy}","received_events_url":"https://api.github.com/users/nnethercote/received_events","type":"User","site_admin":false},"repo":{"id":21260858,"node_id":"MDEwOlJlcG9zaXRvcnkyMTI2MDg1OA==","name":"rust","full_name":"nnethercote/rust","private":false,"owner":{"login":"nnethercote","id":1940286,"node_id":"MDQ6VXNlcjE5NDAyODY=","avatar_url":"https://avatars1.githubusercontent.com/u/1940286?v=4","gravatar_id":"","url":"https://api.github.com/users/nnethercote","html_url":"https://github.com/nnethercote","followers_url":"https://api.github.com/users/nnethercote/followers","following_url":"https://api.github.com/users/nnethercote/following{/other_user}","gists_url":"https://api.github.com/users/nnethercote/gists{/gist_id}","starred_url":"https://api.github.com/users/nnethercote/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nnethercote/subscriptions","organizations_url":"https://api.github.com/users/nnethercote/orgs","repos_url":"https://api.github.com/users/nnethercote/repos","events_url":"https://api.github.com/users/nnethercote/events{/privacy}","received_events_url":"https://api.github.com/users/nnethercote/received_events","type":"User","site_admin":false},"html_url":"https://github.com/nnethercote/rust","description":"a safe, concurrent, practical language","fork":true,"url":"https://api.github.com/repos/nnethercote/rust","forks_url":"https://api.github.com/repos/nnethercote/rust/forks","keys_url":"https://api.github.com/repos/nnethercote/rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nnethercote/rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nnethercote/rust/teams","hooks_url":"https://api.github.com/repos/nnethercote/rust/hooks","issue_events_url":"https://api.github.com/repos/nnethercote/rust/issues/events{/number}","events_url":"https://api.github.com/repos/nnethercote/rust/events","assignees_url":"https://api.github.com/repos/nnethercote/rust/assignees{/user}","branches_url":"https://api.github.com/repos/nnethercote/rust/branches{/branch}","tags_url":"https://api.github.com/repos/nnethercote/rust/tags","blobs_url":"https://api.github.com/repos/nnethercote/rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nnethercote/rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nnethercote/rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/nnethercote/rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nnethercote/rust/statuses/{sha}","languages_url":"https://api.github.com/repos/nnethercote/rust/languages","stargazers_url":"https://api.github.com/repos/nnethercote/rust/stargazers","contributors_url":"https://api.github.com/repos/nnethercote/rust/contributors","subscribers_url":"https://api.github.com/repos/nnethercote/rust/subscribers","subscription_url":"https://api.github.com/repos/nnethercote/rust/subscription","commits_url":"https://api.github.com/repos/nnethercote/rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/nnethercote/rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/nnethercote/rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/nnethercote/rust/issues/comments{/number}","contents_url":"https://api.github.com/repos/nnethercote/rust/contents/{+path}","compare_url":"https://api.github.com/repos/nnethercote/rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nnethercote/rust/merges","archive_url":"https://api.github.com/repos/nnethercote/rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nnethercote/rust/downloads","issues_url":"https://api.github.com/repos/nnethercote/rust/issues{/number}","pulls_url":"https://api.github.com/repos/nnethercote/rust/pulls{/number}","milestones_url":"https://api.github.com/repos/nnethercote/rust/milestones{/number}","notifications_url":"https://api.github.com/repos/nnethercote/rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nnethercote/rust/labels{/name}","releases_url":"https://api.github.com/repos/nnethercote/rust/releases{/id}","deployments_url":"https://api.github.com/repos/nnethercote/rust/deployments","created_at":"2014-06-27T01:56:48Z","updated_at":"2018-11-05T05:18:51Z","pushed_at":"2018-11-05T05:18:38Z","git_url":"git://github.com/nnethercote/rust.git","ssh_url":"git@github.com:nnethercote/rust.git","clone_url":"https://github.com/nnethercote/rust.git","svn_url":"https://github.com/nnethercote/rust","homepage":"http://www.rust-lang.org","size":396464,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rust-lang:master","ref":"master","sha":"de9666f123e800d5fc34210f23127aa6a5d6e4ef","user":{"login":"rust-lang","id":5430905,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0MzA5MDU=","avatar_url":"https://avatars1.githubusercontent.com/u/5430905?v=4","gravatar_id":"","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":724712,"node_id":"MDEwOlJlcG9zaXRvcnk3MjQ3MTI=","name":"rust","full_name":"rust-lang/rust","private":false,"owner":{"login":"rust-lang","id":5430905,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0MzA5MDU=","avatar_url":"https://avatars1.githubusercontent.com/u/5430905?v=4","gravatar_id":"","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/rust-lang/rust","description":"A safe, concurrent, practical language.","fork":false,"url":"https://api.github.com/repos/rust-lang/rust","forks_url":"https://api.github.com/repos/rust-lang/rust/forks","keys_url":"https://api.github.com/repos/rust-lang/rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rust-lang/rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rust-lang/rust/teams","hooks_url":"https://api.github.com/repos/rust-lang/rust/hooks","issue_events_url":"https://api.github.com/repos/rust-lang/rust/issues/events{/number}","events_url":"https://api.github.com/repos/rust-lang/rust/events","assignees_url":"https://api.github.com/repos/rust-lang/rust/assignees{/user}","branches_url":"https://api.github.com/repos/rust-lang/rust/branches{/branch}","tags_url":"https://api.github.com/repos/rust-lang/rust/tags","blobs_url":"https://api.github.com/repos/rust-lang/rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rust-lang/rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rust-lang/rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/rust-lang/rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rust-lang/rust/statuses/{sha}","languages_url":"https://api.github.com/repos/rust-lang/rust/languages","stargazers_url":"https://api.github.com/repos/rust-lang/rust/stargazers","contributors_url":"https://api.github.com/repos/rust-lang/rust/contributors","subscribers_url":"https://api.github.com/repos/rust-lang/rust/subscribers","subscription_url":"https://api.github.com/repos/rust-lang/rust/subscription","commits_url":"https://api.github.com/repos/rust-lang/rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/rust-lang/rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/rust-lang/rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/rust-lang/rust/issues/comments{/number}","contents_url":"https://api.github.com/repos/rust-lang/rust/contents/{+path}","compare_url":"https://api.github.com/repos/rust-lang/rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rust-lang/rust/merges","archive_url":"https://api.github.com/repos/rust-lang/rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rust-lang/rust/downloads","issues_url":"https://api.github.com/repos/rust-lang/rust/issues{/number}","pulls_url":"https://api.github.com/repos/rust-lang/rust/pulls{/number}","milestones_url":"https://api.github.com/repos/rust-lang/rust/milestones{/number}","notifications_url":"https://api.github.com/repos/rust-lang/rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rust-lang/rust/labels{/name}","releases_url":"https://api.github.com/repos/rust-lang/rust/releases{/id}","deployments_url":"https://api.github.com/repos/rust-lang/rust/deployments","created_at":"2010-06-16T20:39:03Z","updated_at":"2018-11-05T19:50:53Z","pushed_at":"2018-11-05T20:25:44Z","git_url":"git://github.com/rust-lang/rust.git","ssh_url":"git@github.com:rust-lang/rust.git","clone_url":"https://github.com/rust-lang/rust.git","svn_url":"https://github.com/rust-lang/rust","homepage":"https://www.rust-lang.org","size":401823,"stargazers_count":31533,"watchers_count":31533,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5271,"mirror_url":null,"archived":false,"open_issues_count":4529,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":5271,"open_issues":4529,"watchers":31533,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/55556"},"html":{"href":"https://github.com/rust-lang/rust/pull/55556"},"issue":{"href":"https://api.github.com/repos/rust-lang/rust/issues/55556"},"comments":{"href":"https://api.github.com/repos/rust-lang/rust/issues/55556/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/55556/comments"},"review_comment":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/55556/commits"},"statuses":{"href":"https://api.github.com/repos/rust-lang/rust/statuses/39c5a8ac3a1b9e1df739e9ada21abd7a5097d9aa"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"cramertj"}}