{"action":"created","comment":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/comments/223184693","pull_request_review_id":162259654,"id":223184693,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMzE4NDY5Mw==","diff_hunk":"@@ -128,9 +128,11 @@ pub fn declare_fn(\n     cx: &CodegenCx<'ll, 'tcx>,\n     name: &str,\n     fn_type: Ty<'tcx>,\n+    is_vtable_shim: bool,\n ) -> &'ll Value {\n-    debug!(\"declare_rust_fn(name={:?}, fn_type={:?})\", name, fn_type);\n-    let sig = common::ty_fn_sig(cx, fn_type);\n+    debug!(\"declare_rust_fn(name={:?}, fn_type={:?}, is_vtable_shim={:?})\",\n+           name, fn_type, is_vtable_shim);\n+    let sig = common::ty_fn_sig_vtable(cx, fn_type, is_vtable_shim);","path":"src/librustc_codegen_llvm/declare.rs","position":null,"original_position":10,"commit_id":"326e3c05289a6a5db31bdbdb449bf4f3225eba2d","original_commit_id":"0d5e0484fd9868cee714ea3f3b14198204506751","user":{"login":"qnighy","id":41755,"node_id":"MDQ6VXNlcjQxNzU1","avatar_url":"https://avatars1.githubusercontent.com/u/41755?v=4","gravatar_id":"","url":"https://api.github.com/users/qnighy","html_url":"https://github.com/qnighy","followers_url":"https://api.github.com/users/qnighy/followers","following_url":"https://api.github.com/users/qnighy/following{/other_user}","gists_url":"https://api.github.com/users/qnighy/gists{/gist_id}","starred_url":"https://api.github.com/users/qnighy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qnighy/subscriptions","organizations_url":"https://api.github.com/users/qnighy/orgs","repos_url":"https://api.github.com/users/qnighy/repos","events_url":"https://api.github.com/users/qnighy/events{/privacy}","received_events_url":"https://api.github.com/users/qnighy/received_events","type":"User","site_admin":false},"body":"As a result of the `ty_fn_sig` refactoring, we now have only a reasonable amount of occurrences of `is_vtable_shim`.","created_at":"2018-10-06T14:59:21Z","updated_at":"2018-10-06T14:59:21Z","html_url":"https://github.com/rust-lang/rust/pull/54183#discussion_r223184693","pull_request_url":"https://api.github.com/repos/rust-lang/rust/pulls/54183","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/comments/223184693"},"html":{"href":"https://github.com/rust-lang/rust/pull/54183#discussion_r223184693"},"pull_request":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/54183"}},"in_reply_to_id":221734972},"pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/54183","id":215286579,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE1Mjg2NTc5","html_url":"https://github.com/rust-lang/rust/pull/54183","diff_url":"https://github.com/rust-lang/rust/pull/54183.diff","patch_url":"https://github.com/rust-lang/rust/pull/54183.patch","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/54183","number":54183,"state":"open","locked":false,"title":"Implement by-value object safety","user":{"login":"qnighy","id":41755,"node_id":"MDQ6VXNlcjQxNzU1","avatar_url":"https://avatars1.githubusercontent.com/u/41755?v=4","gravatar_id":"","url":"https://api.github.com/users/qnighy","html_url":"https://github.com/qnighy","followers_url":"https://api.github.com/users/qnighy/followers","following_url":"https://api.github.com/users/qnighy/following{/other_user}","gists_url":"https://api.github.com/users/qnighy/gists{/gist_id}","starred_url":"https://api.github.com/users/qnighy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qnighy/subscriptions","organizations_url":"https://api.github.com/users/qnighy/orgs","repos_url":"https://api.github.com/users/qnighy/repos","events_url":"https://api.github.com/users/qnighy/events{/privacy}","received_events_url":"https://api.github.com/users/qnighy/received_events","type":"User","site_admin":false},"body":"This PR implements **by-value object safety**, which is part of unsized rvalues #48055. That means, with `#![feature(unsized_locals)]`, you can call a method `fn foo(self, ...)` on trait objects. One aim of this is to enable `Box<FnOnce>`  in the near future.\r\n\r\nThe difficulty here is this: when constructing a vtable for a trait `Foo`, we can't just put the function `<T as Foo>::foo` into the table. If `T` is no larger than `usize`, `self` is usually passed directly. However, as the caller of the vtable doesn't know the concrete `Self` type, we want a variant of `<T as Foo>::foo` where `self` is always passed by reference.\r\n\r\nTherefore, when the compiler encounters such a method to be generated as a vtable entry, it produces a newly introduced instance called `InstanceDef::VtableShim(def_id)` (that wraps the original instance). the shim just derefs the receiver and calls the original method. We give different symbol names for the shims by appending `::{{vtable-shim}}` to the symbol path (and also adding vtable-shimness as an ingredient to the symbol hash).\r\n\r\nr? @eddyb","created_at":"2018-09-13T13:40:34Z","updated_at":"2018-10-06T14:59:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8b69c4253d75f265277ddc12de8e3b064ca20507","assignee":{"login":"arielb1","id":1830974,"node_id":"MDQ6VXNlcjE4MzA5NzQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1830974?v=4","gravatar_id":"","url":"https://api.github.com/users/arielb1","html_url":"https://github.com/arielb1","followers_url":"https://api.github.com/users/arielb1/followers","following_url":"https://api.github.com/users/arielb1/following{/other_user}","gists_url":"https://api.github.com/users/arielb1/gists{/gist_id}","starred_url":"https://api.github.com/users/arielb1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arielb1/subscriptions","organizations_url":"https://api.github.com/users/arielb1/orgs","repos_url":"https://api.github.com/users/arielb1/repos","events_url":"https://api.github.com/users/arielb1/events{/privacy}","received_events_url":"https://api.github.com/users/arielb1/received_events","type":"User","site_admin":false},"assignees":[{"login":"arielb1","id":1830974,"node_id":"MDQ6VXNlcjE4MzA5NzQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1830974?v=4","gravatar_id":"","url":"https://api.github.com/users/arielb1","html_url":"https://github.com/arielb1","followers_url":"https://api.github.com/users/arielb1/followers","following_url":"https://api.github.com/users/arielb1/following{/other_user}","gists_url":"https://api.github.com/users/arielb1/gists{/gist_id}","starred_url":"https://api.github.com/users/arielb1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arielb1/subscriptions","organizations_url":"https://api.github.com/users/arielb1/orgs","repos_url":"https://api.github.com/users/arielb1/repos","events_url":"https://api.github.com/users/arielb1/events{/privacy}","received_events_url":"https://api.github.com/users/arielb1/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":583426710,"node_id":"MDU6TGFiZWw1ODM0MjY3MTA=","url":"https://api.github.com/repos/rust-lang/rust/labels/S-waiting-on-review","name":"S-waiting-on-review","color":"d3dddd","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/rust-lang/rust/pulls/54183/commits","review_comments_url":"https://api.github.com/repos/rust-lang/rust/pulls/54183/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/54183/comments","statuses_url":"https://api.github.com/repos/rust-lang/rust/statuses/326e3c05289a6a5db31bdbdb449bf4f3225eba2d","head":{"label":"qnighy:by-value-object-safety","ref":"by-value-object-safety","sha":"326e3c05289a6a5db31bdbdb449bf4f3225eba2d","user":{"login":"qnighy","id":41755,"node_id":"MDQ6VXNlcjQxNzU1","avatar_url":"https://avatars1.githubusercontent.com/u/41755?v=4","gravatar_id":"","url":"https://api.github.com/users/qnighy","html_url":"https://github.com/qnighy","followers_url":"https://api.github.com/users/qnighy/followers","following_url":"https://api.github.com/users/qnighy/following{/other_user}","gists_url":"https://api.github.com/users/qnighy/gists{/gist_id}","starred_url":"https://api.github.com/users/qnighy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qnighy/subscriptions","organizations_url":"https://api.github.com/users/qnighy/orgs","repos_url":"https://api.github.com/users/qnighy/repos","events_url":"https://api.github.com/users/qnighy/events{/privacy}","received_events_url":"https://api.github.com/users/qnighy/received_events","type":"User","site_admin":false},"repo":{"id":85179430,"node_id":"MDEwOlJlcG9zaXRvcnk4NTE3OTQzMA==","name":"rust","full_name":"qnighy/rust","private":false,"owner":{"login":"qnighy","id":41755,"node_id":"MDQ6VXNlcjQxNzU1","avatar_url":"https://avatars1.githubusercontent.com/u/41755?v=4","gravatar_id":"","url":"https://api.github.com/users/qnighy","html_url":"https://github.com/qnighy","followers_url":"https://api.github.com/users/qnighy/followers","following_url":"https://api.github.com/users/qnighy/following{/other_user}","gists_url":"https://api.github.com/users/qnighy/gists{/gist_id}","starred_url":"https://api.github.com/users/qnighy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qnighy/subscriptions","organizations_url":"https://api.github.com/users/qnighy/orgs","repos_url":"https://api.github.com/users/qnighy/repos","events_url":"https://api.github.com/users/qnighy/events{/privacy}","received_events_url":"https://api.github.com/users/qnighy/received_events","type":"User","site_admin":false},"html_url":"https://github.com/qnighy/rust","description":"A safe, concurrent, practical language.","fork":true,"url":"https://api.github.com/repos/qnighy/rust","forks_url":"https://api.github.com/repos/qnighy/rust/forks","keys_url":"https://api.github.com/repos/qnighy/rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/qnighy/rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/qnighy/rust/teams","hooks_url":"https://api.github.com/repos/qnighy/rust/hooks","issue_events_url":"https://api.github.com/repos/qnighy/rust/issues/events{/number}","events_url":"https://api.github.com/repos/qnighy/rust/events","assignees_url":"https://api.github.com/repos/qnighy/rust/assignees{/user}","branches_url":"https://api.github.com/repos/qnighy/rust/branches{/branch}","tags_url":"https://api.github.com/repos/qnighy/rust/tags","blobs_url":"https://api.github.com/repos/qnighy/rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/qnighy/rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/qnighy/rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/qnighy/rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/qnighy/rust/statuses/{sha}","languages_url":"https://api.github.com/repos/qnighy/rust/languages","stargazers_url":"https://api.github.com/repos/qnighy/rust/stargazers","contributors_url":"https://api.github.com/repos/qnighy/rust/contributors","subscribers_url":"https://api.github.com/repos/qnighy/rust/subscribers","subscription_url":"https://api.github.com/repos/qnighy/rust/subscription","commits_url":"https://api.github.com/repos/qnighy/rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/qnighy/rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/qnighy/rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/qnighy/rust/issues/comments{/number}","contents_url":"https://api.github.com/repos/qnighy/rust/contents/{+path}","compare_url":"https://api.github.com/repos/qnighy/rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/qnighy/rust/merges","archive_url":"https://api.github.com/repos/qnighy/rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/qnighy/rust/downloads","issues_url":"https://api.github.com/repos/qnighy/rust/issues{/number}","pulls_url":"https://api.github.com/repos/qnighy/rust/pulls{/number}","milestones_url":"https://api.github.com/repos/qnighy/rust/milestones{/number}","notifications_url":"https://api.github.com/repos/qnighy/rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/qnighy/rust/labels{/name}","releases_url":"https://api.github.com/repos/qnighy/rust/releases{/id}","deployments_url":"https://api.github.com/repos/qnighy/rust/deployments","created_at":"2017-03-16T09:47:47Z","updated_at":"2017-03-16T09:48:08Z","pushed_at":"2018-10-06T14:52:22Z","git_url":"git://github.com/qnighy/rust.git","ssh_url":"git@github.com:qnighy/rust.git","clone_url":"https://github.com/qnighy/rust.git","svn_url":"https://github.com/qnighy/rust","homepage":"https://www.rust-lang.org","size":392810,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"NOASSERTION","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":"b4d9835f6c1ea0af804d11f79e329f76efd05df6","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-10-06T14:56:55Z","pushed_at":"2018-10-06T14:52:35Z","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":396900,"stargazers_count":31018,"watchers_count":31018,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5219,"mirror_url":null,"archived":false,"open_issues_count":4402,"license":{"key":"other","name":"NOASSERTION","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":5219,"open_issues":4402,"watchers":31018,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/54183"},"html":{"href":"https://github.com/rust-lang/rust/pull/54183"},"issue":{"href":"https://api.github.com/repos/rust-lang/rust/issues/54183"},"comments":{"href":"https://api.github.com/repos/rust-lang/rust/issues/54183/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/54183/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/54183/commits"},"statuses":{"href":"https://api.github.com/repos/rust-lang/rust/statuses/326e3c05289a6a5db31bdbdb449bf4f3225eba2d"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"qnighy"}}