{"action":"created","issue":{"url":"https://api.github.com/repos/rust-rfcs/unsafe-code-guidelines/issues/31","repository_url":"https://api.github.com/repos/rust-rfcs/unsafe-code-guidelines","labels_url":"https://api.github.com/repos/rust-rfcs/unsafe-code-guidelines/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/rust-rfcs/unsafe-code-guidelines/issues/31/comments","events_url":"https://api.github.com/repos/rust-rfcs/unsafe-code-guidelines/issues/31/events","html_url":"https://github.com/rust-rfcs/unsafe-code-guidelines/pull/31","id":363780036,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE4MTMwMTQ0","number":31,"title":"add a stucts-and-tuples chapter","user":{"login":"nikomatsakis","id":155238,"node_id":"MDQ6VXNlcjE1NTIzOA==","avatar_url":"https://avatars0.githubusercontent.com/u/155238?v=4","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},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-25T21:49:52Z","updated_at":"2018-09-26T14:17:37Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/rust-rfcs/unsafe-code-guidelines/pulls/31","html_url":"https://github.com/rust-rfcs/unsafe-code-guidelines/pull/31","diff_url":"https://github.com/rust-rfcs/unsafe-code-guidelines/pull/31.diff","patch_url":"https://github.com/rust-rfcs/unsafe-code-guidelines/pull/31.patch"},"body":"Writes up what I believe to be the consensus around layout of structs and tuples. Suggestions very welcome!\r\n\r\nHere are some of the highlights:\r\n\r\n- Tuples are defined to be laid out as if there were a \"fresh generic struct\" for their arity. So `(T1...Tn)` is laid out the same as `TupleN<T1..Tn>` where `struct TupleN<P0..Pn>(P0..Pn)`.\r\n    - There is an exception for the case where all the types are the same (after lifetime erasure), in which case the layout is guaranteed to be compatible with `[T; N]`.\r\n- Tuple structs are laid out the same as \"named fields\".\r\n- `#[repr(Rust)]` structs (the default) have no particular layout guarantees. In particular, even if two `#[repr(Rust)]` structs have the fields of the same types, they are not guaranteed to be laid out in a compatible way. This is a conservative position that could be strengthened, though I personally now think it'd be better to \"opt-in\" to any such guarantees. I cover the pros and cons in the doc.\r\n- `#[repr(C)]`, `#[repr(align)]`, `#[repr(packed)]`, and `#[repr(transparent)]` are all discussed.\r\n\r\nFixes #11 and #12."},"comment":{"url":"https://api.github.com/repos/rust-rfcs/unsafe-code-guidelines/issues/comments/424732525","html_url":"https://github.com/rust-rfcs/unsafe-code-guidelines/pull/31#issuecomment-424732525","issue_url":"https://api.github.com/repos/rust-rfcs/unsafe-code-guidelines/issues/31","id":424732525,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNDczMjUyNQ==","user":{"login":"nikomatsakis","id":155238,"node_id":"MDQ6VXNlcjE1NTIzOA==","avatar_url":"https://avatars0.githubusercontent.com/u/155238?v=4","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":"2018-09-26T14:17:37Z","updated_at":"2018-09-26T14:17:37Z","author_association":"COLLABORATOR","body":"Pushed an update containing the various suggestions from @eddyb."}}
{"actor":{"display_login":"nikomatsakis"}}