{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/41640","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/41640/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/41640/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/41640/events","html_url":"https://github.com/rust-lang/rust/pull/41640","id":225292623,"number":41640,"title":"Consider changing to & for let bindings #40402","user":{"login":"gaurikholkar","id":9420877,"avatar_url":"https://avatars2.githubusercontent.com/u/9420877?v=3","gravatar_id":"","url":"https://api.github.com/users/gaurikholkar","html_url":"https://github.com/gaurikholkar","followers_url":"https://api.github.com/users/gaurikholkar/followers","following_url":"https://api.github.com/users/gaurikholkar/following{/other_user}","gists_url":"https://api.github.com/users/gaurikholkar/gists{/gist_id}","starred_url":"https://api.github.com/users/gaurikholkar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaurikholkar/subscriptions","organizations_url":"https://api.github.com/users/gaurikholkar/orgs","repos_url":"https://api.github.com/users/gaurikholkar/repos","events_url":"https://api.github.com/users/gaurikholkar/events{/privacy}","received_events_url":"https://api.github.com/users/gaurikholkar/received_events","type":"User","site_admin":false},"labels":[{"id":583426710,"url":"https://api.github.com/repos/rust-lang/rust/labels/S-waiting-on-review","name":"S-waiting-on-review","color":"d3dddd","default":false}],"state":"open","locked":false,"assignee":{"login":"nikomatsakis","id":155238,"avatar_url":"https://avatars3.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},"assignees":[{"login":"nikomatsakis","id":155238,"avatar_url":"https://avatars3.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":10,"created_at":"2017-04-29T23:34:06Z","updated_at":"2017-05-02T12:06:54Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/41640","html_url":"https://github.com/rust-lang/rust/pull/41640","diff_url":"https://github.com/rust-lang/rust/pull/41640.diff","patch_url":"https://github.com/rust-lang/rust/pull/41640.patch"},"body":"This is a fix for #40402 \r\n\r\nFor the example\r\n```\r\nfn main() {\r\n    let v = vec![String::from(\"oh no\")];\r\n    \r\n    let e = v[0];\r\n}\r\n```\r\n\r\nIt gives\r\n```\r\nerror[E0507]: cannot move out of indexed content\r\n --> ex1.rs:4:13\r\n  |\r\n4 |     let e = v[0];\r\n  |             ^^^^ cannot move out of indexed content\r\n  |\r\n  = help: consider changing to `&v[0]`\r\n\r\nerror: aborting due to previous error\r\n```\r\n\r\nAnother alternative is\r\n```\r\nerror[E0507]: cannot move out of indexed content\r\n --> ex1.rs:4:13\r\n  |\r\n4 |     let e = v[0];\r\n  |             ^^^^ consider changing to `&v[0]`\r\n\r\nerror: aborting due to previous error\r\n```\r\nAlso refer to #41564 for more details.\r\n\r\nr? @nikomatsakis\r\n"},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/298616789","html_url":"https://github.com/rust-lang/rust/pull/41640#issuecomment-298616789","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/41640","id":298616789,"user":{"login":"gaurikholkar","id":9420877,"avatar_url":"https://avatars2.githubusercontent.com/u/9420877?v=3","gravatar_id":"","url":"https://api.github.com/users/gaurikholkar","html_url":"https://github.com/gaurikholkar","followers_url":"https://api.github.com/users/gaurikholkar/followers","following_url":"https://api.github.com/users/gaurikholkar/following{/other_user}","gists_url":"https://api.github.com/users/gaurikholkar/gists{/gist_id}","starred_url":"https://api.github.com/users/gaurikholkar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaurikholkar/subscriptions","organizations_url":"https://api.github.com/users/gaurikholkar/orgs","repos_url":"https://api.github.com/users/gaurikholkar/repos","events_url":"https://api.github.com/users/gaurikholkar/events{/privacy}","received_events_url":"https://api.github.com/users/gaurikholkar/received_events","type":"User","site_admin":false},"created_at":"2017-05-02T12:06:54Z","updated_at":"2017-05-02T12:06:54Z","body":"Using `span_suggestions` the output is \r\n\r\n```\r\nerror[E0507]: cannot move out of indexed content\r\n --> ex1.rs:4:13\r\n  |\r\n4 |     let e = v[0];\r\n  |             ^^^^\r\n  |             |\r\n  |             help: consider using a reference instead  `&v[0]`\r\n  |             cannot move out of indexed content\r\n\r\nerror: aborting due to previous error\r\n```"}}
{"actor":{"display_login":"gaurikholkar"}}