{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/35348","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/35348/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/35348/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/35348/events","html_url":"https://github.com/rust-lang/rust/pull/35348","id":169500239,"number":35348,"title":"[MIR] Add explicit SetDiscriminant StatementKind for deaggregating enums","user":{"login":"scottcarr","id":472477,"avatar_url":"https://avatars.githubusercontent.com/u/472477?v=3","gravatar_id":"","url":"https://api.github.com/users/scottcarr","html_url":"https://github.com/scottcarr","followers_url":"https://api.github.com/users/scottcarr/followers","following_url":"https://api.github.com/users/scottcarr/following{/other_user}","gists_url":"https://api.github.com/users/scottcarr/gists{/gist_id}","starred_url":"https://api.github.com/users/scottcarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottcarr/subscriptions","organizations_url":"https://api.github.com/users/scottcarr/orgs","repos_url":"https://api.github.com/users/scottcarr/repos","events_url":"https://api.github.com/users/scottcarr/events{/privacy}","received_events_url":"https://api.github.com/users/scottcarr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"nikomatsakis","id":155238,"avatar_url":"https://avatars.githubusercontent.com/u/155238?v=3","gravatar_id":"","url":"https://api.github.com/users/nikomatsakis","html_url":"https://github.com/nikomatsakis","followers_url":"https://api.github.com/users/nikomatsakis/followers","following_url":"https://api.github.com/users/nikomatsakis/following{/other_user}","gists_url":"https://api.github.com/users/nikomatsakis/gists{/gist_id}","starred_url":"https://api.github.com/users/nikomatsakis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikomatsakis/subscriptions","organizations_url":"https://api.github.com/users/nikomatsakis/orgs","repos_url":"https://api.github.com/users/nikomatsakis/repos","events_url":"https://api.github.com/users/nikomatsakis/events{/privacy}","received_events_url":"https://api.github.com/users/nikomatsakis/received_events","type":"User","site_admin":false},"assignees":[{"login":"nikomatsakis","id":155238,"avatar_url":"https://avatars.githubusercontent.com/u/155238?v=3","gravatar_id":"","url":"https://api.github.com/users/nikomatsakis","html_url":"https://github.com/nikomatsakis","followers_url":"https://api.github.com/users/nikomatsakis/followers","following_url":"https://api.github.com/users/nikomatsakis/following{/other_user}","gists_url":"https://api.github.com/users/nikomatsakis/gists{/gist_id}","starred_url":"https://api.github.com/users/nikomatsakis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikomatsakis/subscriptions","organizations_url":"https://api.github.com/users/nikomatsakis/orgs","repos_url":"https://api.github.com/users/nikomatsakis/repos","events_url":"https://api.github.com/users/nikomatsakis/events{/privacy}","received_events_url":"https://api.github.com/users/nikomatsakis/received_events","type":"User","site_admin":false}],"milestone":null,"comments":9,"created_at":"2016-08-04T23:52:41Z","updated_at":"2016-08-05T17:31:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/35348","html_url":"https://github.com/rust-lang/rust/pull/35348","diff_url":"https://github.com/rust-lang/rust/pull/35348.diff","patch_url":"https://github.com/rust-lang/rust/pull/35348.patch"},"body":"cc #35186\r\n\r\nTo deaggregate enums, we need to be able to explicitly set the discriminant.  This PR implements a new StatementKind that does that.  \r\n\r\nI think some of the places that have `panics!` now could maybe do something smarter."},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/237912358","html_url":"https://github.com/rust-lang/rust/pull/35348#issuecomment-237912358","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/35348","id":237912358,"user":{"login":"nikomatsakis","id":155238,"avatar_url":"https://avatars.githubusercontent.com/u/155238?v=3","gravatar_id":"","url":"https://api.github.com/users/nikomatsakis","html_url":"https://github.com/nikomatsakis","followers_url":"https://api.github.com/users/nikomatsakis/followers","following_url":"https://api.github.com/users/nikomatsakis/following{/other_user}","gists_url":"https://api.github.com/users/nikomatsakis/gists{/gist_id}","starred_url":"https://api.github.com/users/nikomatsakis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikomatsakis/subscriptions","organizations_url":"https://api.github.com/users/nikomatsakis/orgs","repos_url":"https://api.github.com/users/nikomatsakis/repos","events_url":"https://api.github.com/users/nikomatsakis/events{/privacy}","received_events_url":"https://api.github.com/users/nikomatsakis/received_events","type":"User","site_admin":false},"created_at":"2016-08-05T17:31:26Z","updated_at":"2016-08-05T17:31:26Z","body":"Ah, here is one other reason. Using a statement like this, we can very easily guarantee (via the MIR definition) that the variant is always statically known. This is important because we want things like \"SetDiscriminant(x, Some)` to be a noop if `x: Option<&T>` (since, in that case, just setting the value is enough). But if it were `x.discriminant = y`, we'd have to dynamically test what `y` evaluated to."}}
{"actor":{"display_login":"nikomatsakis"}}