{"action":"closed","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/19997","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/19997/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/19997/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/19997/events","html_url":"https://github.com/rust-lang/rust/issues/19997","id":52428535,"number":19997,"title":"Memory unsafety using & bindings more than one level deep when destructuring","user":{"login":"pythonesque","id":923144,"avatar_url":"https://avatars.githubusercontent.com/u/923144?v=3","gravatar_id":"","url":"https://api.github.com/users/pythonesque","html_url":"https://github.com/pythonesque","followers_url":"https://api.github.com/users/pythonesque/followers","following_url":"https://api.github.com/users/pythonesque/following{/other_user}","gists_url":"https://api.github.com/users/pythonesque/gists{/gist_id}","starred_url":"https://api.github.com/users/pythonesque/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pythonesque/subscriptions","organizations_url":"https://api.github.com/users/pythonesque/orgs","repos_url":"https://api.github.com/users/pythonesque/repos","events_url":"https://api.github.com/users/pythonesque/events{/privacy}","received_events_url":"https://api.github.com/users/pythonesque/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rust/labels/I-nominated","name":"I-nominated","color":"e10c02"}],"state":"closed","locked":false,"assignee":{"login":"nikomatsakis","id":155238,"avatar_url":"https://avatars.githubusercontent.com/u/155238?v=3","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":5,"created_at":"2014-12-18T23:11:04Z","updated_at":"2015-01-06T11:31:42Z","closed_at":"2015-01-06T11:31:42Z","body":"This segfaults.\r\n```rust\r\n// Note: you can also replicate this with this function signature.\r\n// fn foo<'a, 'b, 'c>(mut pair: (&'c mut &'a mut Vec<Option<String>>, &'b mut Vec<&'a mut Option<String>>)) {\r\n//     let mut pair = (&mut a, &mut b);\r\n// }\r\n\r\nfn main() {\r\n    let mut a = Vec::new();\r\n    let mut a = &mut a;\r\n    let mut b = Vec::new();\r\n    for _ in range(0u8, 9) {\r\n        //foo((&mut a, &mut b));\r\n        // Correctly complains if you do: let (ref mut a, ref mut b) = (&mut a, &mut b);\r\n        // Also correctly complains in Rust 0.12.\r\n        let (&ref mut a, ref mut b) = (&mut a, &mut b);\r\n        a.push(Some(\"\".to_string()));\r\n        let index = a.len() - 1;\r\n        let data = a.as_mut_slice().get_mut(index).unwrap();\r\n        b.push(data);\r\n    }\r\n    println!(\"{}\", b);\r\n}\r\n```"}}