{"action":"created","comment":{"url":"https://api.github.com/repos/solson/miri/pulls/comments/89700612","pull_request_review_id":10239083,"id":89700612,"diff_hunk":"@@ -196,51 +198,49 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {\n             }\n \n             \"fabsf32\" => {\n-                let f = self.value_to_primval(arg_vals[2], f32)?\n-                    .expect_f32(\"fabsf32 read non f32\");\n-                self.write_primval(dest, PrimVal::from_f32(f.abs()))?;\n+                let f = self.value_to_primval(arg_vals[2], f32)?.to_f32();\n+                self.write_primval(dest, PrimVal::from_f32(f.abs()), dest_ty)?;\n             }\n \n             \"fabsf64\" => {\n-                let f = self.value_to_primval(arg_vals[2], f64)?\n-                    .expect_f64(\"fabsf64 read non f64\");\n-                self.write_primval(dest, PrimVal::from_f64(f.abs()))?;\n+                let f = self.value_to_primval(arg_vals[2], f64)?.to_f64();\n+                self.write_primval(dest, PrimVal::from_f64(f.abs()), dest_ty)?;\n             }\n \n             \"fadd_fast\" => {\n                 let ty = substs.type_at(0);\n+                let kind = self.ty_to_primval_kind(ty)?;\n                 let a = self.value_to_primval(arg_vals[0], ty)?;\n                 let b = self.value_to_primval(arg_vals[0], ty)?;\n-                let result = primval::binary_op(mir::BinOp::Add, a, b)?;\n-                self.write_primval(dest, result.0)?;\n+                let result = primval::binary_op(mir::BinOp::Add, a, kind, b, kind)?;\n+                self.write_primval(dest, result.0, dest_ty)?;\n             }\n \n             \"likely\" |\n             \"unlikely\" |\n             \"forget\" => {}\n \n             \"init\" => {\n-                let size = dest_layout.size(&self.tcx.data_layout).bytes();\n+                let size = self.type_size(dest_ty)?.expect(\"cannot init unsized value\");;","path":"src/interpreter/terminator/intrinsics.rs","position":138,"original_position":138,"commit_id":"fd022857880175900dd22533ec7243ff0fa5ad49","original_commit_id":"fd022857880175900dd22533ec7243ff0fa5ad49","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":"Or `cannot call \"init\" intrinsic for unsized type`.","created_at":"2016-11-27T21:46:10Z","updated_at":"2016-11-27T21:46:11Z","html_url":"https://github.com/solson/miri/pull/89#discussion_r89700612","pull_request_url":"https://api.github.com/repos/solson/miri/pulls/89","_links":{"self":{"href":"https://api.github.com/repos/solson/miri/pulls/comments/89700612"},"html":{"href":"https://github.com/solson/miri/pull/89#discussion_r89700612"},"pull_request":{"href":"https://api.github.com/repos/solson/miri/pulls/89"}}},"pull_request":{"url":"https://api.github.com/repos/solson/miri/pulls/89","id":95394953,"html_url":"https://github.com/solson/miri/pull/89","diff_url":"https://github.com/solson/miri/pull/89.diff","patch_url":"https://github.com/solson/miri/pull/89.patch","issue_url":"https://api.github.com/repos/solson/miri/issues/89","number":89,"state":"open","locked":false,"title":"Remove PrimValKind field from PrimVal.","user":{"login":"solson","id":26806,"avatar_url":"https://avatars.githubusercontent.com/u/26806?v=3","gravatar_id":"","url":"https://api.github.com/users/solson","html_url":"https://github.com/solson","followers_url":"https://api.github.com/users/solson/followers","following_url":"https://api.github.com/users/solson/following{/other_user}","gists_url":"https://api.github.com/users/solson/gists{/gist_id}","starred_url":"https://api.github.com/users/solson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solson/subscriptions","organizations_url":"https://api.github.com/users/solson/orgs","repos_url":"https://api.github.com/users/solson/repos","events_url":"https://api.github.com/users/solson/events{/privacy}","received_events_url":"https://api.github.com/users/solson/received_events","type":"User","site_admin":false},"body":"@oli-obk @eddyb I wrote this code a month ago, but just today rebased it over @oli-obk's many changes (:heart:). All the tests are passing, but the code is not fresh in my mind and some nonsense might have crept in with the rebase, so I'd like some external code review before merging.\r\n\r\n----\r\n\r\nThis is a refactoring we've wanted to do for quite a while, ever since @eddyb suggested the current `PrimVal` representation to me. In a future PR I think we will want to go further and remove `PrimValKind` entirely, making all choices based on `Ty`s instead.\r\n\r\nI think there are also some more simplifications this refactoring enables that I haven't done yet, e.g. in the casting code.","created_at":"2016-11-27T07:29:13Z","updated_at":"2016-11-27T21:46:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e12e21aa5ba9d759274e1840379dc8c25a52e10b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/solson/miri/pulls/89/commits","review_comments_url":"https://api.github.com/repos/solson/miri/pulls/89/comments","review_comment_url":"https://api.github.com/repos/solson/miri/pulls/comments{/number}","comments_url":"https://api.github.com/repos/solson/miri/issues/89/comments","statuses_url":"https://api.github.com/repos/solson/miri/statuses/fd022857880175900dd22533ec7243ff0fa5ad49","head":{"label":"solson:unkind-primval","ref":"unkind-primval","sha":"fd022857880175900dd22533ec7243ff0fa5ad49","user":{"login":"solson","id":26806,"avatar_url":"https://avatars.githubusercontent.com/u/26806?v=3","gravatar_id":"","url":"https://api.github.com/users/solson","html_url":"https://github.com/solson","followers_url":"https://api.github.com/users/solson/followers","following_url":"https://api.github.com/users/solson/following{/other_user}","gists_url":"https://api.github.com/users/solson/gists{/gist_id}","starred_url":"https://api.github.com/users/solson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solson/subscriptions","organizations_url":"https://api.github.com/users/solson/orgs","repos_url":"https://api.github.com/users/solson/repos","events_url":"https://api.github.com/users/solson/events{/privacy}","received_events_url":"https://api.github.com/users/solson/received_events","type":"User","site_admin":false},"repo":{"id":46083140,"name":"miri","full_name":"solson/miri","owner":{"login":"solson","id":26806,"avatar_url":"https://avatars.githubusercontent.com/u/26806?v=3","gravatar_id":"","url":"https://api.github.com/users/solson","html_url":"https://github.com/solson","followers_url":"https://api.github.com/users/solson/followers","following_url":"https://api.github.com/users/solson/following{/other_user}","gists_url":"https://api.github.com/users/solson/gists{/gist_id}","starred_url":"https://api.github.com/users/solson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solson/subscriptions","organizations_url":"https://api.github.com/users/solson/orgs","repos_url":"https://api.github.com/users/solson/repos","events_url":"https://api.github.com/users/solson/events{/privacy}","received_events_url":"https://api.github.com/users/solson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/solson/miri","description":"An interpreter for Rust's mid-level intermediate representation","fork":false,"url":"https://api.github.com/repos/solson/miri","forks_url":"https://api.github.com/repos/solson/miri/forks","keys_url":"https://api.github.com/repos/solson/miri/keys{/key_id}","collaborators_url":"https://api.github.com/repos/solson/miri/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/solson/miri/teams","hooks_url":"https://api.github.com/repos/solson/miri/hooks","issue_events_url":"https://api.github.com/repos/solson/miri/issues/events{/number}","events_url":"https://api.github.com/repos/solson/miri/events","assignees_url":"https://api.github.com/repos/solson/miri/assignees{/user}","branches_url":"https://api.github.com/repos/solson/miri/branches{/branch}","tags_url":"https://api.github.com/repos/solson/miri/tags","blobs_url":"https://api.github.com/repos/solson/miri/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/solson/miri/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/solson/miri/git/refs{/sha}","trees_url":"https://api.github.com/repos/solson/miri/git/trees{/sha}","statuses_url":"https://api.github.com/repos/solson/miri/statuses/{sha}","languages_url":"https://api.github.com/repos/solson/miri/languages","stargazers_url":"https://api.github.com/repos/solson/miri/stargazers","contributors_url":"https://api.github.com/repos/solson/miri/contributors","subscribers_url":"https://api.github.com/repos/solson/miri/subscribers","subscription_url":"https://api.github.com/repos/solson/miri/subscription","commits_url":"https://api.github.com/repos/solson/miri/commits{/sha}","git_commits_url":"https://api.github.com/repos/solson/miri/git/commits{/sha}","comments_url":"https://api.github.com/repos/solson/miri/comments{/number}","issue_comment_url":"https://api.github.com/repos/solson/miri/issues/comments{/number}","contents_url":"https://api.github.com/repos/solson/miri/contents/{+path}","compare_url":"https://api.github.com/repos/solson/miri/compare/{base}...{head}","merges_url":"https://api.github.com/repos/solson/miri/merges","archive_url":"https://api.github.com/repos/solson/miri/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/solson/miri/downloads","issues_url":"https://api.github.com/repos/solson/miri/issues{/number}","pulls_url":"https://api.github.com/repos/solson/miri/pulls{/number}","milestones_url":"https://api.github.com/repos/solson/miri/milestones{/number}","notifications_url":"https://api.github.com/repos/solson/miri/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/solson/miri/labels{/name}","releases_url":"https://api.github.com/repos/solson/miri/releases{/id}","deployments_url":"https://api.github.com/repos/solson/miri/deployments","created_at":"2015-11-12T21:51:25Z","updated_at":"2016-11-27T07:46:37Z","pushed_at":"2016-11-27T07:42:24Z","git_url":"git://github.com/solson/miri.git","ssh_url":"git@github.com:solson/miri.git","clone_url":"https://github.com/solson/miri.git","svn_url":"https://github.com/solson/miri","homepage":"","size":1213,"stargazers_count":136,"watchers_count":136,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":25,"mirror_url":null,"open_issues_count":8,"forks":25,"open_issues":8,"watchers":136,"default_branch":"master"}},"base":{"label":"solson:master","ref":"master","sha":"16f3b590e46062a0db728e7764dc64d23851c4db","user":{"login":"solson","id":26806,"avatar_url":"https://avatars.githubusercontent.com/u/26806?v=3","gravatar_id":"","url":"https://api.github.com/users/solson","html_url":"https://github.com/solson","followers_url":"https://api.github.com/users/solson/followers","following_url":"https://api.github.com/users/solson/following{/other_user}","gists_url":"https://api.github.com/users/solson/gists{/gist_id}","starred_url":"https://api.github.com/users/solson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solson/subscriptions","organizations_url":"https://api.github.com/users/solson/orgs","repos_url":"https://api.github.com/users/solson/repos","events_url":"https://api.github.com/users/solson/events{/privacy}","received_events_url":"https://api.github.com/users/solson/received_events","type":"User","site_admin":false},"repo":{"id":46083140,"name":"miri","full_name":"solson/miri","owner":{"login":"solson","id":26806,"avatar_url":"https://avatars.githubusercontent.com/u/26806?v=3","gravatar_id":"","url":"https://api.github.com/users/solson","html_url":"https://github.com/solson","followers_url":"https://api.github.com/users/solson/followers","following_url":"https://api.github.com/users/solson/following{/other_user}","gists_url":"https://api.github.com/users/solson/gists{/gist_id}","starred_url":"https://api.github.com/users/solson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solson/subscriptions","organizations_url":"https://api.github.com/users/solson/orgs","repos_url":"https://api.github.com/users/solson/repos","events_url":"https://api.github.com/users/solson/events{/privacy}","received_events_url":"https://api.github.com/users/solson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/solson/miri","description":"An interpreter for Rust's mid-level intermediate representation","fork":false,"url":"https://api.github.com/repos/solson/miri","forks_url":"https://api.github.com/repos/solson/miri/forks","keys_url":"https://api.github.com/repos/solson/miri/keys{/key_id}","collaborators_url":"https://api.github.com/repos/solson/miri/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/solson/miri/teams","hooks_url":"https://api.github.com/repos/solson/miri/hooks","issue_events_url":"https://api.github.com/repos/solson/miri/issues/events{/number}","events_url":"https://api.github.com/repos/solson/miri/events","assignees_url":"https://api.github.com/repos/solson/miri/assignees{/user}","branches_url":"https://api.github.com/repos/solson/miri/branches{/branch}","tags_url":"https://api.github.com/repos/solson/miri/tags","blobs_url":"https://api.github.com/repos/solson/miri/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/solson/miri/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/solson/miri/git/refs{/sha}","trees_url":"https://api.github.com/repos/solson/miri/git/trees{/sha}","statuses_url":"https://api.github.com/repos/solson/miri/statuses/{sha}","languages_url":"https://api.github.com/repos/solson/miri/languages","stargazers_url":"https://api.github.com/repos/solson/miri/stargazers","contributors_url":"https://api.github.com/repos/solson/miri/contributors","subscribers_url":"https://api.github.com/repos/solson/miri/subscribers","subscription_url":"https://api.github.com/repos/solson/miri/subscription","commits_url":"https://api.github.com/repos/solson/miri/commits{/sha}","git_commits_url":"https://api.github.com/repos/solson/miri/git/commits{/sha}","comments_url":"https://api.github.com/repos/solson/miri/comments{/number}","issue_comment_url":"https://api.github.com/repos/solson/miri/issues/comments{/number}","contents_url":"https://api.github.com/repos/solson/miri/contents/{+path}","compare_url":"https://api.github.com/repos/solson/miri/compare/{base}...{head}","merges_url":"https://api.github.com/repos/solson/miri/merges","archive_url":"https://api.github.com/repos/solson/miri/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/solson/miri/downloads","issues_url":"https://api.github.com/repos/solson/miri/issues{/number}","pulls_url":"https://api.github.com/repos/solson/miri/pulls{/number}","milestones_url":"https://api.github.com/repos/solson/miri/milestones{/number}","notifications_url":"https://api.github.com/repos/solson/miri/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/solson/miri/labels{/name}","releases_url":"https://api.github.com/repos/solson/miri/releases{/id}","deployments_url":"https://api.github.com/repos/solson/miri/deployments","created_at":"2015-11-12T21:51:25Z","updated_at":"2016-11-27T07:46:37Z","pushed_at":"2016-11-27T07:42:24Z","git_url":"git://github.com/solson/miri.git","ssh_url":"git@github.com:solson/miri.git","clone_url":"https://github.com/solson/miri.git","svn_url":"https://github.com/solson/miri","homepage":"","size":1213,"stargazers_count":136,"watchers_count":136,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":25,"mirror_url":null,"open_issues_count":8,"forks":25,"open_issues":8,"watchers":136,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/solson/miri/pulls/89"},"html":{"href":"https://github.com/solson/miri/pull/89"},"issue":{"href":"https://api.github.com/repos/solson/miri/issues/89"},"comments":{"href":"https://api.github.com/repos/solson/miri/issues/89/comments"},"review_comments":{"href":"https://api.github.com/repos/solson/miri/pulls/89/comments"},"review_comment":{"href":"https://api.github.com/repos/solson/miri/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/solson/miri/pulls/89/commits"},"statuses":{"href":"https://api.github.com/repos/solson/miri/statuses/fd022857880175900dd22533ec7243ff0fa5ad49"}}}}
{"actor":{"display_login":"eddyb"}}