{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/26270","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/26270/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/26270/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/26270/events","html_url":"https://github.com/rust-lang/rust/issues/26270","id":87988747,"number":26270,"title":"Wrapping<T> does not wrap on shift operations","user":{"login":"nwin","id":949560,"avatar_url":"https://avatars.githubusercontent.com/u/949560?v=3","gravatar_id":"","url":"https://api.github.com/users/nwin","html_url":"https://github.com/nwin","followers_url":"https://api.github.com/users/nwin/followers","following_url":"https://api.github.com/users/nwin/following{/other_user}","gists_url":"https://api.github.com/users/nwin/gists{/gist_id}","starred_url":"https://api.github.com/users/nwin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nwin/subscriptions","organizations_url":"https://api.github.com/users/nwin/orgs","repos_url":"https://api.github.com/users/nwin/repos","events_url":"https://api.github.com/users/nwin/events{/privacy}","received_events_url":"https://api.github.com/users/nwin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rust/labels/A-libs","name":"A-libs","color":"d7e102"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-06-13T11:27:22Z","updated_at":"2016-04-20T05:00:30Z","closed_at":"2016-04-20T05:00:30Z","body":"The following code leads to a panic:\r\n\r\n```rust\r\nuse std::num::Wrapping;\r\nfn main() {\r\n    println!(\"{}\", (Wrapping(1i32) >> (32usize)).0)\r\n}\r\n```\r\n\r\nThis is surprising as the description of `Wrapping` implies, that all implemented arithmetic operations just overflow (somehow). It also contradicts the behavior of the unstable method `u32::wrapping_shr`. The latter has also a slightly surprising behavior since `1u32.wrapping_shr(32) == 1`, `1u32.wrapping_shr(33) == 0`, `1u32.wrapping_shr(64) == 1` etc."},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/212257417","html_url":"https://github.com/rust-lang/rust/issues/26270#issuecomment-212257417","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/26270","id":212257417,"user":{"login":"alexcrichton","id":64996,"avatar_url":"https://avatars.githubusercontent.com/u/64996?v=3","gravatar_id":"","url":"https://api.github.com/users/alexcrichton","html_url":"https://github.com/alexcrichton","followers_url":"https://api.github.com/users/alexcrichton/followers","following_url":"https://api.github.com/users/alexcrichton/following{/other_user}","gists_url":"https://api.github.com/users/alexcrichton/gists{/gist_id}","starred_url":"https://api.github.com/users/alexcrichton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexcrichton/subscriptions","organizations_url":"https://api.github.com/users/alexcrichton/orgs","repos_url":"https://api.github.com/users/alexcrichton/repos","events_url":"https://api.github.com/users/alexcrichton/events{/privacy}","received_events_url":"https://api.github.com/users/alexcrichton/received_events","type":"User","site_admin":false},"created_at":"2016-04-20T05:00:30Z","updated_at":"2016-04-20T05:00:30Z","body":"Indeed!"}}