{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/44060","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/44060/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/44060/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/44060/events","html_url":"https://github.com/rust-lang/rust/pull/44060","id":252298852,"number":44060,"title":"Fixes issue #43205: ICE in Rvalue::Len evaluation.","user":{"login":"taleks","id":93178,"avatar_url":"https://avatars3.githubusercontent.com/u/93178?v=4","gravatar_id":"","url":"https://api.github.com/users/taleks","html_url":"https://github.com/taleks","followers_url":"https://api.github.com/users/taleks/followers","following_url":"https://api.github.com/users/taleks/following{/other_user}","gists_url":"https://api.github.com/users/taleks/gists{/gist_id}","starred_url":"https://api.github.com/users/taleks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taleks/subscriptions","organizations_url":"https://api.github.com/users/taleks/orgs","repos_url":"https://api.github.com/users/taleks/repos","events_url":"https://api.github.com/users/taleks/events{/privacy}","received_events_url":"https://api.github.com/users/taleks/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":"arielb1","id":1830974,"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,"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}],"milestone":null,"comments":3,"created_at":"2017-08-23T14:15:09Z","updated_at":"2017-08-27T10:19:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/44060","html_url":"https://github.com/rust-lang/rust/pull/44060","diff_url":"https://github.com/rust-lang/rust/pull/44060.diff","patch_url":"https://github.com/rust-lang/rust/pull/44060.patch"},"body":"- fixes evaluation of array length for zero-sized type referenced by rvalue operand.\r\n- adds test to verify fix.\r\n\r\n*Cause of the issue*.\r\n\r\nZero-sized aggregates are handled as operands, not lvalues. Therefore while visiting `Assign` statement by `LocalAnalyser`, `mark_as_lvalue()` is not called for related `Local`. This behaviour is controlled by `rvalue_creates_operand()` method.\r\n\r\nAs result it causes error later, when rvalue operand is evaluated in `trans_rvalue_operand()` while handling `Rvalue::Len` case. Array length evaluation invokes `trans_lvalue()` which expects referenced `Local` to be value, not operand.\r\n\r\n*How it is fixed*.\r\n\r\nIn certain cases result of `Rvalue::Len` can be evaluated without calling\r\n`trans_lvalue()`. Method `evaluate_array_len()` is introduced to handle length\r\nevaluation for zero-sized types referenced by Locals.\r\n\r\n*Some concerns*.\r\n\r\n- `trans_lvalue()` has two other entry points in `rvalue.rs`: it is invoked while handling `Rvalue::Ref` and `Rvalue::Discriminant`. There is a chance those may produce the same issue, but I've failed to write a specific test that leads to this. \r\n- `evaluate_array_len()` performs the same check (matches lvalue and `Local`), which is performed again in `trans_lvalue()`. Without changing `trans_lvalue()` signature to make it aware that caller deals with rvalue, it seems there is no cheap solution to avoid this check."},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/325189633","html_url":"https://github.com/rust-lang/rust/pull/44060#issuecomment-325189633","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/44060","id":325189633,"user":{"login":"arielb1","id":1830974,"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},"created_at":"2017-08-27T10:19:49Z","updated_at":"2017-08-27T10:19:49Z","body":"@bors r+"}}
{"actor":{"display_login":"arielb1"}}