{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rfcs/issues/2229","repository_url":"https://api.github.com/repos/rust-lang/rfcs","labels_url":"https://api.github.com/repos/rust-lang/rfcs/issues/2229/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rfcs/issues/2229/comments","events_url":"https://api.github.com/repos/rust-lang/rfcs/issues/2229/events","html_url":"https://github.com/rust-lang/rfcs/pull/2229","id":277612211,"node_id":"MDExOlB1bGxSZXF1ZXN0MTU1MjM3NDcy","number":2229,"title":"Closures Capture Disjoint Fields","user":{"login":"samsartor","id":1740180,"node_id":"MDQ6VXNlcjE3NDAxODA=","avatar_url":"https://avatars3.githubusercontent.com/u/1740180?v=4","gravatar_id":"","url":"https://api.github.com/users/samsartor","html_url":"https://github.com/samsartor","followers_url":"https://api.github.com/users/samsartor/followers","following_url":"https://api.github.com/users/samsartor/following{/other_user}","gists_url":"https://api.github.com/users/samsartor/gists{/gist_id}","starred_url":"https://api.github.com/users/samsartor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samsartor/subscriptions","organizations_url":"https://api.github.com/users/samsartor/orgs","repos_url":"https://api.github.com/users/samsartor/repos","events_url":"https://api.github.com/users/samsartor/events{/privacy}","received_events_url":"https://api.github.com/users/samsartor/received_events","type":"User","site_admin":false},"labels":[{"id":211667886,"node_id":"MDU6TGFiZWwyMTE2Njc4ODY=","url":"https://api.github.com/repos/rust-lang/rfcs/labels/T-lang","name":"T-lang","color":"bfd4f2","default":false},{"id":921950520,"node_id":"MDU6TGFiZWw5MjE5NTA1MjA=","url":"https://api.github.com/repos/rust-lang/rfcs/labels/disposition-merge","name":"disposition-merge","color":"008800","default":false},{"id":921176177,"node_id":"MDU6TGFiZWw5MjExNzYxNzc=","url":"https://api.github.com/repos/rust-lang/rfcs/labels/finished-final-comment-period","name":"finished-final-comment-period","color":"f9e189","default":false}],"state":"open","locked":false,"assignee":{"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},"assignees":[{"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}],"milestone":null,"comments":77,"created_at":"2017-11-29T02:53:42Z","updated_at":"2018-08-10T22:50:50Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/rust-lang/rfcs/pulls/2229","html_url":"https://github.com/rust-lang/rfcs/pull/2229","diff_url":"https://github.com/rust-lang/rfcs/pull/2229.diff","patch_url":"https://github.com/rust-lang/rfcs/pull/2229.patch"},"body":"TL;DR: Closures will capture individual fields and not the whole struct when possible.\r\n\r\nThis RFC proposes that closure capturing should be minimal rather than maximal.\r\nSpecifically, existing rules regarding borrowing and moving disjoint fields\r\nshould be applied to capturing. If implemented, the following code examples\r\nwould become valid:\r\n\r\n```rust\r\nlet _a = &mut foo.a;\r\n|| &mut foo.b; // Error! cannot borrow `foo`\r\n```\r\n\r\n```rust\r\nlet _a = &mut foo.a;\r\nmove || foo.b; // Error! cannot move `foo`\r\n```\r\n\r\nResolves rust-lang/rust#19004\r\n\r\n[Rendered](https://github.com/samsartor/rust-rfcs/blob/master/text/0000-capture-disjoint-fields.md)"},"comment":{"url":"https://api.github.com/repos/rust-lang/rfcs/issues/comments/412226141","html_url":"https://github.com/rust-lang/rfcs/pull/2229#issuecomment-412226141","issue_url":"https://api.github.com/repos/rust-lang/rfcs/issues/2229","id":412226141,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMjIyNjE0MQ==","user":{"login":"samsartor","id":1740180,"node_id":"MDQ6VXNlcjE3NDAxODA=","avatar_url":"https://avatars3.githubusercontent.com/u/1740180?v=4","gravatar_id":"","url":"https://api.github.com/users/samsartor","html_url":"https://github.com/samsartor","followers_url":"https://api.github.com/users/samsartor/followers","following_url":"https://api.github.com/users/samsartor/following{/other_user}","gists_url":"https://api.github.com/users/samsartor/gists{/gist_id}","starred_url":"https://api.github.com/users/samsartor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samsartor/subscriptions","organizations_url":"https://api.github.com/users/samsartor/orgs","repos_url":"https://api.github.com/users/samsartor/repos","events_url":"https://api.github.com/users/samsartor/events{/privacy}","received_events_url":"https://api.github.com/users/samsartor/received_events","type":"User","site_admin":false},"created_at":"2018-08-10T22:50:50Z","updated_at":"2018-08-10T22:50:50Z","author_association":"NONE","body":"@nikomatsakis YES! Looks like we are on exactly the same page.\r\n@Centril I'm ready for this to be merged."}}
{"actor":{"display_login":"samsartor"}}