{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/23030","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/23030/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/23030/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/23030/events","html_url":"https://github.com/rust-lang/rust/issues/23030","id":59819356,"number":23030,"title":"Should C-style enums silently overflow?","user":{"login":"pnkfelix","id":173127,"avatar_url":"https://avatars.githubusercontent.com/u/173127?v=3","gravatar_id":"","url":"https://api.github.com/users/pnkfelix","html_url":"https://github.com/pnkfelix","followers_url":"https://api.github.com/users/pnkfelix/followers","following_url":"https://api.github.com/users/pnkfelix/following{/other_user}","gists_url":"https://api.github.com/users/pnkfelix/gists{/gist_id}","starred_url":"https://api.github.com/users/pnkfelix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pnkfelix/subscriptions","organizations_url":"https://api.github.com/users/pnkfelix/orgs","repos_url":"https://api.github.com/users/pnkfelix/repos","events_url":"https://api.github.com/users/pnkfelix/events{/privacy}","received_events_url":"https://api.github.com/users/pnkfelix/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rust/labels/I-nominated","name":"I-nominated","color":"e10c02"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-03-04T16:08:48Z","updated_at":"2015-03-04T16:57:07Z","closed_at":null,"body":"Spawned off of a note from PR #22532 on commit 1246d4067fdc034d064dfb78f88c2c3c079c3f4f\r\n\r\nThe following program:\r\n```rust\r\n#[repr(usize)]\r\nenum Foo {\r\n    A = 0xffffffffffffffff_usize,\r\n    B,\r\n    C\r\n}\r\n\r\nfn main() {\r\n    println!(\"Hello World: {:x}\", Foo::A as usize);\r\n    println!(\"Hello World: {:x}\", Foo::B as usize);\r\n    println!(\"Hello World: {:x}\", Foo::C as usize);\r\n}\r\n```\r\n\r\ncompiles and prints:\r\n```\r\nHello World: ffffffffffffffff\r\nHello World: 0\r\nHello World: 1\r\n```\r\n\r\nMy personal preference would be for a compiler error due to the implicit overflow, with a note saying that the programmer should explicitly assign some value to `Foo::B`. (And thus they can opt into the current behavior by assigning it `B = 0,`; then `Foo::C` would continue to be assigned 1 as today.)"},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/77197200","html_url":"https://github.com/rust-lang/rust/issues/23030#issuecomment-77197200","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/23030","id":77197200,"user":{"login":"nrc","id":762626,"avatar_url":"https://avatars.githubusercontent.com/u/762626?v=3","gravatar_id":"","url":"https://api.github.com/users/nrc","html_url":"https://github.com/nrc","followers_url":"https://api.github.com/users/nrc/followers","following_url":"https://api.github.com/users/nrc/following{/other_user}","gists_url":"https://api.github.com/users/nrc/gists{/gist_id}","starred_url":"https://api.github.com/users/nrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nrc/subscriptions","organizations_url":"https://api.github.com/users/nrc/orgs","repos_url":"https://api.github.com/users/nrc/repos","events_url":"https://api.github.com/users/nrc/events{/privacy}","received_events_url":"https://api.github.com/users/nrc/received_events","type":"User","site_admin":false},"created_at":"2015-03-04T16:57:07Z","updated_at":"2015-03-04T16:57:07Z","body":"Hmm, no it is not, I guess it tried to find the milestone \"I suggest P-backcompat-lang, I-needs-decision.\", but I have no idea how it ended up with \"1.0 beta\". I'll look into it (also, I'll only check inside parens on the same line"}}