{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/53773","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/53773/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/53773/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/53773/events","html_url":"https://github.com/rust-lang/rust/issues/53773","id":354903691,"node_id":"MDU6SXNzdWUzNTQ5MDM2OTE=","number":53773,"title":"NLL reports \"borrow used here in later iteration of loop\" in cases outside of loop","user":{"login":"pnkfelix","id":173127,"node_id":"MDQ6VXNlcjE3MzEyNw==","avatar_url":"https://avatars0.githubusercontent.com/u/173127?v=4","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":[{"id":604489711,"node_id":"MDU6TGFiZWw2MDQ0ODk3MTE=","url":"https://api.github.com/repos/rust-lang/rust/labels/A-NLL","name":"A-NLL","color":"d7e102","default":false},{"id":867465998,"node_id":"MDU6TGFiZWw4Njc0NjU5OTg=","url":"https://api.github.com/repos/rust-lang/rust/labels/NLL-diagnostics","name":"NLL-diagnostics","color":"f799ea","default":false}],"state":"open","locked":false,"assignee":{"login":"blitzerr","id":28721905,"node_id":"MDQ6VXNlcjI4NzIxOTA1","avatar_url":"https://avatars0.githubusercontent.com/u/28721905?v=4","gravatar_id":"","url":"https://api.github.com/users/blitzerr","html_url":"https://github.com/blitzerr","followers_url":"https://api.github.com/users/blitzerr/followers","following_url":"https://api.github.com/users/blitzerr/following{/other_user}","gists_url":"https://api.github.com/users/blitzerr/gists{/gist_id}","starred_url":"https://api.github.com/users/blitzerr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blitzerr/subscriptions","organizations_url":"https://api.github.com/users/blitzerr/orgs","repos_url":"https://api.github.com/users/blitzerr/repos","events_url":"https://api.github.com/users/blitzerr/events{/privacy}","received_events_url":"https://api.github.com/users/blitzerr/received_events","type":"User","site_admin":false},"assignees":[{"login":"blitzerr","id":28721905,"node_id":"MDQ6VXNlcjI4NzIxOTA1","avatar_url":"https://avatars0.githubusercontent.com/u/28721905?v=4","gravatar_id":"","url":"https://api.github.com/users/blitzerr","html_url":"https://github.com/blitzerr","followers_url":"https://api.github.com/users/blitzerr/followers","following_url":"https://api.github.com/users/blitzerr/following{/other_user}","gists_url":"https://api.github.com/users/blitzerr/gists{/gist_id}","starred_url":"https://api.github.com/users/blitzerr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blitzerr/subscriptions","organizations_url":"https://api.github.com/users/blitzerr/orgs","repos_url":"https://api.github.com/users/blitzerr/repos","events_url":"https://api.github.com/users/blitzerr/events{/privacy}","received_events_url":"https://api.github.com/users/blitzerr/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/rust-lang/rust/milestones/55","html_url":"https://github.com/rust-lang/rust/milestone/55","labels_url":"https://api.github.com/repos/rust-lang/rust/milestones/55/labels","id":3463307,"node_id":"MDk6TWlsZXN0b25lMzQ2MzMwNw==","number":55,"title":"Rust 2018 Release","description":"See https://internals.rust-lang.org/t/rust-2018-the-home-stretch/7810","creator":{"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},"open_issues":14,"closed_issues":21,"state":"open","created_at":"2018-06-29T18:51:49Z","updated_at":"2018-11-08T14:57:16Z","due_on":"2018-12-06T08:00:00Z","closed_at":null},"comments":7,"created_at":"2018-08-28T21:05:12Z","updated_at":"2018-11-08T14:58:09Z","closed_at":null,"author_association":"MEMBER","body":"Spawned off of https://github.com/rust-lang/rust/issues/53220#issuecomment-411760394\r\n\r\nIn this code ([play](https://play.rust-lang.org/?gist=5bbb4640a98bcddae6b0f1569e31807c&version=nightly&mode=debug&edition=2015)), we report \"borrow used here in later iteration of loop\" for the `members.len()` call that is not within the loop.\r\n\r\n```\r\n#![feature(nll)]\r\n\r\nstruct Archive;\r\nstruct ArchiveIterator<'a> { x: &'a Archive }\r\nstruct ArchiveChild<'a> { x: &'a Archive }\r\n\r\nstruct A { raw: &'static mut Archive }\r\nstruct Iter<'a> { raw: &'a mut ArchiveIterator<'a> }\r\nstruct C<'a> { raw: &'a mut ArchiveChild<'a> }\r\n\r\nimpl A { pub fn iter(&self) -> Iter<'_> { panic!() } }\r\nimpl Drop for A { fn drop(&mut self) { } }\r\nimpl<'a> Drop for C<'a> { fn drop(&mut self) { } }\r\n\r\nimpl<'a> Iterator for Iter<'a> {\r\n    type Item = C<'a>;\r\n    fn next(&mut self) -> Option<C<'a>> { panic!() }\r\n}\r\n\r\n\r\nfn error(archive: &A) {\r\n    let mut members: Vec<&mut ArchiveChild<'_>> = vec![];\r\n    for child in archive.iter() {\r\n        members.push(child.raw);\r\n    }\r\n    members.len();\r\n}\r\n  \r\nfn main() { }\r\n```\r\n\r\n(I assume this is due to some bug in how we are attempting to reverse-engineer the existence of a loop by analyzing the basic-block control-flow of MIR alone.)"},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/437024884","html_url":"https://github.com/rust-lang/rust/issues/53773#issuecomment-437024884","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/53773","id":437024884,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzAyNDg4NA==","user":{"login":"pnkfelix","id":173127,"node_id":"MDQ6VXNlcjE3MzEyNw==","avatar_url":"https://avatars0.githubusercontent.com/u/173127?v=4","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},"created_at":"2018-11-08T14:58:09Z","updated_at":"2018-11-08T14:58:09Z","author_association":"MEMBER","body":"I spoke too soon.\r\n\r\nThe current output, according to [play](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2015&gist=ec4e521f3ec7029816198f0d79584a37), is:\r\n\r\n```\r\nerror[E0713]: borrow may still be in use when destructor runs\r\n  --> src/main.rs:24:22\r\n   |\r\n24 |         members.push(child.raw);\r\n   |                      ^^^^^^^^^\r\n25 |     }\r\n   |     - here, drop of `child` needs exclusive access to `*child.raw`, because the type `C<'_>` implements the `Drop` trait\r\n26 |     members.len();\r\n   |     ------- borrow used here, in later iteration of loop\r\n\r\nerror: aborting due to previous error\r\n```\r\n\r\nso, we still have the \"in later iteration of loop\" in the diagnostic."}}
{"actor":{"display_login":"pnkfelix"}}