{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/45225","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/45225/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/45225/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/45225/events","html_url":"https://github.com/rust-lang/rust/pull/45225","id":264795374,"number":45225,"title":"Refactor type memory layouts and ABIs, to be more general and easier to optimize.","user":{"login":"eddyb","id":77424,"avatar_url":"https://avatars2.githubusercontent.com/u/77424?v=4","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},"labels":[{"id":281249002,"url":"https://api.github.com/repos/rust-lang/rust/labels/S-waiting-on-crater","name":"S-waiting-on-crater","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":75,"created_at":"2017-10-12T02:34:06Z","updated_at":"2017-11-18T21:25:34Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/45225","html_url":"https://github.com/rust-lang/rust/pull/45225","diff_url":"https://github.com/rust-lang/rust/pull/45225.diff","patch_url":"https://github.com/rust-lang/rust/pull/45225.patch"},"body":"To combat combinatorial explosion, type layouts are now described through 3 orthogonal properties:\r\n* `Variants` describes the plurality of sum types (where applicable)\r\n  * `Single` is for one inhabited/active variant, including all C `struct`s and `union`s\r\n  * `Tagged` has its variants discriminated by an integer tag, including C `enum`s\r\n  * `NicheFilling` uses otherwise-invalid values (\"niches\") for all but one of its inhabited variants\r\n* `FieldPlacement` describes the number and memory offsets of fields (if any)\r\n  * `Union` has all its fields at offset `0`\r\n  * `Array` has offsets that are a multiple of its `stride`; guarantees all fields have one type\r\n  * `Arbitrary` records all the field offsets, which can be out-of-order\r\n* `Abi` describes how values of the type should be passed around, including for FFI\r\n  * `Uninhabited` corresponds to no values, associated with unreachable control-flow\r\n  * `Scalar` is ABI-identical to its only integer/floating-point/pointer \"scalar component\"\r\n  * `ScalarPair` has two \"scalar components\", but only applies to the Rust ABI\r\n  * `Vector` is for SIMD vectors, typically `#[repr(simd)]` `struct`s in Rust\r\n  * `Aggregate` has arbitrary contents, including all non-transparent C `struct`s and `union`s\r\n\r\nSize optimizations implemented so far:\r\n* ignoring uninhabited variants (i.e. containing uninhabited fields), e.g.:\r\n  * `Option<!>` is 0 bytes\r\n  * `Result<T, !>` has the same size as `T`\r\n* using arbitrary niches, not just `0`, to represent a data-less variant, e.g.:\r\n  * `Option<bool>`, `Option<Option<bool>>`, `Option<Ordering>` are all 1 byte\r\n  * `Option<char>` is 4 bytes\r\n* using a range of niches to represent *multiple* data-less variants, e.g.:\r\n  * `enum E { A(bool), B, C, D }` is 1 byte\r\n\r\nCode generation now takes advantage of `Scalar` and `ScalarPair` to, in more cases, pass around scalar components as immediates instead of indirectly, through pointers into temporary memory, while avoiding LLVM's \"first-class aggregates\", and there's more untapped potential here.\r\n\r\nCloses #44426, fixes #5977, fixes #14540, fixes #43278."},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/345472444","html_url":"https://github.com/rust-lang/rust/pull/45225#issuecomment-345472444","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/45225","id":345472444,"user":{"login":"bors","id":3372342,"avatar_url":"https://avatars2.githubusercontent.com/u/3372342?v=4","gravatar_id":"","url":"https://api.github.com/users/bors","html_url":"https://github.com/bors","followers_url":"https://api.github.com/users/bors/followers","following_url":"https://api.github.com/users/bors/following{/other_user}","gists_url":"https://api.github.com/users/bors/gists{/gist_id}","starred_url":"https://api.github.com/users/bors/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bors/subscriptions","organizations_url":"https://api.github.com/users/bors/orgs","repos_url":"https://api.github.com/users/bors/repos","events_url":"https://api.github.com/users/bors/events{/privacy}","received_events_url":"https://api.github.com/users/bors/received_events","type":"User","site_admin":false},"created_at":"2017-11-18T21:25:33Z","updated_at":"2017-11-18T21:25:33Z","author_association":"CONTRIBUTOR","body":":pushpin: Commit d6926dd has been approved by `arielb1`\n\n<!-- @bors r=arielb1 d6926ddf87a4d87f1731286b6c6eb4ad850fb9b7 -->"}}
{"actor":{"display_login":"bors"}}