{"action":"created","comment":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/comments/93487458","pull_request_review_id":14016583,"id":93487458,"diff_hunk":"@@ -252,23 +253,65 @@ pub fn implement_drop_glue<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, g: DropGlueKi\n             // No support in vtable for distinguishing destroying with\n             // versus without calling Drop::drop. Assert caller is\n             // okay with always calling the Drop impl, if any.\n-            // FIXME(#36457) -- we should pass unsized values to drop glue as two arguments\n             assert!(!skip_dtor);\n-            let data_ptr = get_dataptr(&bcx, v0);\n-            let vtable_ptr = bcx.load(get_meta(&bcx, v0));\n-            let dtor = bcx.load(vtable_ptr);\n-            bcx.call(dtor, &[bcx.pointercast(bcx.load(data_ptr), Type::i8p(bcx.ccx))], None);\n+            let dtor = bcx.load(ptr.meta);\n+            bcx.call(dtor, &[ptr.value], None);\n             bcx\n         }\n         ty::TyAdt(def, ..) if def.dtor_kind().is_present() && !skip_dtor => {\n-            trans_custom_dtor(bcx, t, v0, def.is_union())\n+            let shallow_drop = def.is_union();\n+            let tcx = bcx.tcx();\n+\n+            let def = t.ty_adt_def().unwrap();\n+\n+            // Be sure to put the contents into a scope so we can use an invoke\n+            // instruction to call the user destructor but still call the field\n+            // destructors if the user destructor panics.\n+            //\n+            // FIXME (#14875) panic-in-drop semantics might be unsupported; we\n+            // might well consider changing below to more direct code.\n+            // Issue #23611: schedule cleanup of contents, re-inspecting the\n+            // discriminant (if any) in case of variant swap in drop code.\n+            let contents_scope = if !shallow_drop {\n+                bcx.fcx().schedule_drop_adt_contents(ptr, t)\n+            } else {\n+                CleanupScope::noop()\n+            };\n+\n+            let trait_ref = ty::Binder(ty::TraitRef {\n+                def_id: tcx.lang_items.drop_trait().unwrap(),\n+                substs: tcx.mk_substs_trait(t, &[])\n+            });\n+            let vtbl = match fulfill_obligation(bcx.ccx.shared(), DUMMY_SP, trait_ref) {\n+                traits::VtableImpl(data) => data,\n+                _ => bug!(\"dtor for {:?} is not an impl???\", t)\n+            };\n+            let dtor_did = def.destructor().unwrap();\n+            let callee = Callee::def(bcx.ccx, dtor_did, vtbl.substs);\n+            let fn_ty = callee.direct_fn_type(bcx.ccx, &[]);\n+            let llret;\n+            if let Some(landing_pad) = contents_scope.landing_pad {\n+                let normal_bcx = bcx.fcx().build_new_block(\"normal-return\");\n+                llret = bcx.invoke(callee.reify(ccx),\n+                    &[ptr.value, ptr.meta][..1 + ptr.has_meta() as usize],\n+                    normal_bcx.llbb(),\n+                    landing_pad,\n+                    None);\n+                bcx = normal_bcx;\n+            } else {\n+                llret = bcx.call(callee.reify(bcx.ccx),\n+                    &[ptr.value, ptr.meta][..1 + ptr.has_meta() as usize], None);","path":"src/librustc_trans/glue.rs","position":157,"original_position":157,"commit_id":"0c45a4da0451b14424703971008473ff2bcf8e02","original_commit_id":"0c45a4da0451b14424703971008473ff2bcf8e02","user":{"login":"eddyb","id":77424,"avatar_url":"https://avatars.githubusercontent.com/u/77424?v=3","gravatar_id":"","url":"https://api.github.com/users/eddyb","html_url":"https://github.com/eddyb","followers_url":"https://api.github.com/users/eddyb/followers","following_url":"https://api.github.com/users/eddyb/following{/other_user}","gists_url":"https://api.github.com/users/eddyb/gists{/gist_id}","starred_url":"https://api.github.com/users/eddyb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eddyb/subscriptions","organizations_url":"https://api.github.com/users/eddyb/orgs","repos_url":"https://api.github.com/users/eddyb/repos","events_url":"https://api.github.com/users/eddyb/events{/privacy}","received_events_url":"https://api.github.com/users/eddyb/received_events","type":"User","site_admin":false},"body":"Can you lift the arguments out of the `if-let`/`else`?","created_at":"2016-12-21T17:57:05Z","updated_at":"2016-12-21T17:57:05Z","html_url":"https://github.com/rust-lang/rust/pull/38511#discussion_r93487458","pull_request_url":"https://api.github.com/repos/rust-lang/rust/pulls/38511","_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/comments/93487458"},"html":{"href":"https://github.com/rust-lang/rust/pull/38511#discussion_r93487458"},"pull_request":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/38511"}}},"pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/38511","id":98937716,"html_url":"https://github.com/rust-lang/rust/pull/38511","diff_url":"https://github.com/rust-lang/rust/pull/38511.diff","patch_url":"https://github.com/rust-lang/rust/pull/38511.patch","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/38511","number":38511,"state":"open","locked":false,"title":"Make drop glue for unsized value pass two arguments instead of *(data, meta)","user":{"login":"Mark-Simulacrum","id":5047365,"avatar_url":"https://avatars.githubusercontent.com/u/5047365?v=3","gravatar_id":"","url":"https://api.github.com/users/Mark-Simulacrum","html_url":"https://github.com/Mark-Simulacrum","followers_url":"https://api.github.com/users/Mark-Simulacrum/followers","following_url":"https://api.github.com/users/Mark-Simulacrum/following{/other_user}","gists_url":"https://api.github.com/users/Mark-Simulacrum/gists{/gist_id}","starred_url":"https://api.github.com/users/Mark-Simulacrum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mark-Simulacrum/subscriptions","organizations_url":"https://api.github.com/users/Mark-Simulacrum/orgs","repos_url":"https://api.github.com/users/Mark-Simulacrum/repos","events_url":"https://api.github.com/users/Mark-Simulacrum/events{/privacy}","received_events_url":"https://api.github.com/users/Mark-Simulacrum/received_events","type":"User","site_admin":false},"body":"Fixes #36457\r\n\r\nr? @eddyb ","created_at":"2016-12-21T14:01:50Z","updated_at":"2016-12-21T17:57:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b32ecbc09d34ab810b90598cfcdba38136eacb9a","assignee":{"login":"eddyb","id":77424,"avatar_url":"https://avatars.githubusercontent.com/u/77424?v=3","gravatar_id":"","url":"https://api.github.com/users/eddyb","html_url":"https://github.com/eddyb","followers_url":"https://api.github.com/users/eddyb/followers","following_url":"https://api.github.com/users/eddyb/following{/other_user}","gists_url":"https://api.github.com/users/eddyb/gists{/gist_id}","starred_url":"https://api.github.com/users/eddyb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eddyb/subscriptions","organizations_url":"https://api.github.com/users/eddyb/orgs","repos_url":"https://api.github.com/users/eddyb/repos","events_url":"https://api.github.com/users/eddyb/events{/privacy}","received_events_url":"https://api.github.com/users/eddyb/received_events","type":"User","site_admin":false},"assignees":[{"login":"eddyb","id":77424,"avatar_url":"https://avatars.githubusercontent.com/u/77424?v=3","gravatar_id":"","url":"https://api.github.com/users/eddyb","html_url":"https://github.com/eddyb","followers_url":"https://api.github.com/users/eddyb/followers","following_url":"https://api.github.com/users/eddyb/following{/other_user}","gists_url":"https://api.github.com/users/eddyb/gists{/gist_id}","starred_url":"https://api.github.com/users/eddyb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eddyb/subscriptions","organizations_url":"https://api.github.com/users/eddyb/orgs","repos_url":"https://api.github.com/users/eddyb/repos","events_url":"https://api.github.com/users/eddyb/events{/privacy}","received_events_url":"https://api.github.com/users/eddyb/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/rust-lang/rust/pulls/38511/commits","review_comments_url":"https://api.github.com/repos/rust-lang/rust/pulls/38511/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/38511/comments","statuses_url":"https://api.github.com/repos/rust-lang/rust/statuses/0c45a4da0451b14424703971008473ff2bcf8e02","head":{"label":"Mark-Simulacrum:drop-glue","ref":"drop-glue","sha":"0c45a4da0451b14424703971008473ff2bcf8e02","user":{"login":"Mark-Simulacrum","id":5047365,"avatar_url":"https://avatars.githubusercontent.com/u/5047365?v=3","gravatar_id":"","url":"https://api.github.com/users/Mark-Simulacrum","html_url":"https://github.com/Mark-Simulacrum","followers_url":"https://api.github.com/users/Mark-Simulacrum/followers","following_url":"https://api.github.com/users/Mark-Simulacrum/following{/other_user}","gists_url":"https://api.github.com/users/Mark-Simulacrum/gists{/gist_id}","starred_url":"https://api.github.com/users/Mark-Simulacrum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mark-Simulacrum/subscriptions","organizations_url":"https://api.github.com/users/Mark-Simulacrum/orgs","repos_url":"https://api.github.com/users/Mark-Simulacrum/repos","events_url":"https://api.github.com/users/Mark-Simulacrum/events{/privacy}","received_events_url":"https://api.github.com/users/Mark-Simulacrum/received_events","type":"User","site_admin":false},"repo":{"id":65503623,"name":"rust","full_name":"Mark-Simulacrum/rust","owner":{"login":"Mark-Simulacrum","id":5047365,"avatar_url":"https://avatars.githubusercontent.com/u/5047365?v=3","gravatar_id":"","url":"https://api.github.com/users/Mark-Simulacrum","html_url":"https://github.com/Mark-Simulacrum","followers_url":"https://api.github.com/users/Mark-Simulacrum/followers","following_url":"https://api.github.com/users/Mark-Simulacrum/following{/other_user}","gists_url":"https://api.github.com/users/Mark-Simulacrum/gists{/gist_id}","starred_url":"https://api.github.com/users/Mark-Simulacrum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mark-Simulacrum/subscriptions","organizations_url":"https://api.github.com/users/Mark-Simulacrum/orgs","repos_url":"https://api.github.com/users/Mark-Simulacrum/repos","events_url":"https://api.github.com/users/Mark-Simulacrum/events{/privacy}","received_events_url":"https://api.github.com/users/Mark-Simulacrum/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Mark-Simulacrum/rust","description":"A safe, concurrent, practical language.","fork":true,"url":"https://api.github.com/repos/Mark-Simulacrum/rust","forks_url":"https://api.github.com/repos/Mark-Simulacrum/rust/forks","keys_url":"https://api.github.com/repos/Mark-Simulacrum/rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Mark-Simulacrum/rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Mark-Simulacrum/rust/teams","hooks_url":"https://api.github.com/repos/Mark-Simulacrum/rust/hooks","issue_events_url":"https://api.github.com/repos/Mark-Simulacrum/rust/issues/events{/number}","events_url":"https://api.github.com/repos/Mark-Simulacrum/rust/events","assignees_url":"https://api.github.com/repos/Mark-Simulacrum/rust/assignees{/user}","branches_url":"https://api.github.com/repos/Mark-Simulacrum/rust/branches{/branch}","tags_url":"https://api.github.com/repos/Mark-Simulacrum/rust/tags","blobs_url":"https://api.github.com/repos/Mark-Simulacrum/rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Mark-Simulacrum/rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Mark-Simulacrum/rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/Mark-Simulacrum/rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Mark-Simulacrum/rust/statuses/{sha}","languages_url":"https://api.github.com/repos/Mark-Simulacrum/rust/languages","stargazers_url":"https://api.github.com/repos/Mark-Simulacrum/rust/stargazers","contributors_url":"https://api.github.com/repos/Mark-Simulacrum/rust/contributors","subscribers_url":"https://api.github.com/repos/Mark-Simulacrum/rust/subscribers","subscription_url":"https://api.github.com/repos/Mark-Simulacrum/rust/subscription","commits_url":"https://api.github.com/repos/Mark-Simulacrum/rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/Mark-Simulacrum/rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/Mark-Simulacrum/rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/Mark-Simulacrum/rust/issues/comments{/number}","contents_url":"https://api.github.com/repos/Mark-Simulacrum/rust/contents/{+path}","compare_url":"https://api.github.com/repos/Mark-Simulacrum/rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Mark-Simulacrum/rust/merges","archive_url":"https://api.github.com/repos/Mark-Simulacrum/rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Mark-Simulacrum/rust/downloads","issues_url":"https://api.github.com/repos/Mark-Simulacrum/rust/issues{/number}","pulls_url":"https://api.github.com/repos/Mark-Simulacrum/rust/pulls{/number}","milestones_url":"https://api.github.com/repos/Mark-Simulacrum/rust/milestones{/number}","notifications_url":"https://api.github.com/repos/Mark-Simulacrum/rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Mark-Simulacrum/rust/labels{/name}","releases_url":"https://api.github.com/repos/Mark-Simulacrum/rust/releases{/id}","deployments_url":"https://api.github.com/repos/Mark-Simulacrum/rust/deployments","created_at":"2016-08-11T21:46:30Z","updated_at":"2016-08-11T21:46:49Z","pushed_at":"2016-12-21T17:49:16Z","git_url":"git://github.com/Mark-Simulacrum/rust.git","ssh_url":"git@github.com:Mark-Simulacrum/rust.git","clone_url":"https://github.com/Mark-Simulacrum/rust.git","svn_url":"https://github.com/Mark-Simulacrum/rust","homepage":"https://www.rust-lang.org","size":317784,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rust-lang:master","ref":"master","sha":"1b38776c1f68c6fd47c1b2f7b7974efc7dd64901","user":{"login":"rust-lang","id":5430905,"avatar_url":"https://avatars.githubusercontent.com/u/5430905?v=3","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,"name":"rust","full_name":"rust-lang/rust","owner":{"login":"rust-lang","id":5430905,"avatar_url":"https://avatars.githubusercontent.com/u/5430905?v=3","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},"private":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":"2016-12-21T17:56:51Z","pushed_at":"2016-12-21T17:49:19Z","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":318235,"stargazers_count":19461,"watchers_count":19461,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3725,"mirror_url":null,"open_issues_count":2977,"forks":3725,"open_issues":2977,"watchers":19461,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/38511"},"html":{"href":"https://github.com/rust-lang/rust/pull/38511"},"issue":{"href":"https://api.github.com/repos/rust-lang/rust/issues/38511"},"comments":{"href":"https://api.github.com/repos/rust-lang/rust/issues/38511/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/38511/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/38511/commits"},"statuses":{"href":"https://api.github.com/repos/rust-lang/rust/statuses/0c45a4da0451b14424703971008473ff2bcf8e02"}}}}
{"actor":{"display_login":"eddyb"}}