{"push_id":561034441,"size":18,"distinct_size":0,"ref":"refs/heads/auto","head":"56b0e324b031e7805ae182dd756fbbb7e1bdb95a","before":"3fbfad3519af1bf5dd903f6032265da0351862ea","commits":[{"sha":"a65d3f5b98cc94f0a759fbf1a08be9aee0f97883","author":{"email":"550518ab9d14bd32155907315f74849d7b5c2b36@gmail.com","name":"Jorge Aparicio"},"message":"core: add the `IntoIterator` trait","distinct":false,"url":"https://api.github.com/repos/rust-lang/rust/commits/a65d3f5b98cc94f0a759fbf1a08be9aee0f97883"},{"sha":"9fdc0effd292b097ae487ec4d927ca15102c5791","author":{"email":"550518ab9d14bd32155907315f74849d7b5c2b36@gmail.com","name":"Jorge Aparicio"},"message":"implement for loop desugaring","distinct":false,"url":"https://api.github.com/repos/rust-lang/rust/commits/9fdc0effd292b097ae487ec4d927ca15102c5791"},{"sha":"f9865eac185ef2af4df661442d5d3bd2698b725f","author":{"email":"550518ab9d14bd32155907315f74849d7b5c2b36@gmail.com","name":"Jorge Aparicio"},"message":"fix fallout","distinct":false,"url":"https://api.github.com/repos/rust-lang/rust/commits/f9865eac185ef2af4df661442d5d3bd2698b725f"},{"sha":"5e1820f34611e311759518440fd4129c5f0c322a","author":{"email":"550518ab9d14bd32155907315f74849d7b5c2b36@gmail.com","name":"Jorge Aparicio"},"message":"fix tests","distinct":false,"url":"https://api.github.com/repos/rust-lang/rust/commits/5e1820f34611e311759518440fd4129c5f0c322a"},{"sha":"76362f0a0ee1b66d7df524c4c8dea9b15b45cf78","author":{"email":"550518ab9d14bd32155907315f74849d7b5c2b36@gmail.com","name":"Jorge Aparicio"},"message":"custom message for refutable patterns in for loops","distinct":false,"url":"https://api.github.com/repos/rust-lang/rust/commits/76362f0a0ee1b66d7df524c4c8dea9b15b45cf78"},{"sha":"acb8c1aaa6f3aa46cc3abf9ccc77b4882d778f9c","author":{"email":"550518ab9d14bd32155907315f74849d7b5c2b36@gmail.com","name":"Jorge Aparicio"},"message":"remove more `ExprForLoop`s","distinct":false,"url":"https://api.github.com/repos/rust-lang/rust/commits/acb8c1aaa6f3aa46cc3abf9ccc77b4882d778f9c"},{"sha":"a8733162772feec5f498427ea10d869272d164ab","author":{"email":"550518ab9d14bd32155907315f74849d7b5c2b36@gmail.com","name":"Jorge Aparicio"},"message":"remove dead code","distinct":false,"url":"https://api.github.com/repos/rust-lang/rust/commits/a8733162772feec5f498427ea10d869272d164ab"},{"sha":"9070345c0ef6ceb38aced40aee3deee4ca2f8e17","author":{"email":"550518ab9d14bd32155907315f74849d7b5c2b36@gmail.com","name":"Jorge Aparicio"},"message":"add tests","distinct":false,"url":"https://api.github.com/repos/rust-lang/rust/commits/9070345c0ef6ceb38aced40aee3deee4ca2f8e17"},{"sha":"ed82b5a70e0ddeea284addef7762375ae5880672","author":{"email":"550518ab9d14bd32155907315f74849d7b5c2b36@gmail.com","name":"Jorge Aparicio"},"message":"remove Copy impls from iterators","distinct":false,"url":"https://api.github.com/repos/rust-lang/rust/commits/ed82b5a70e0ddeea284addef7762375ae5880672"},{"sha":"bfaf4227b8bbe81e89a05a5d371726a64b54ceaa","author":{"email":"550518ab9d14bd32155907315f74849d7b5c2b36@gmail.com","name":"Jorge Aparicio"},"message":"smoke out remaining bugs","distinct":false,"url":"https://api.github.com/repos/rust-lang/rust/commits/bfaf4227b8bbe81e89a05a5d371726a64b54ceaa"},{"sha":"d4b3e7f09c4d48685923aaeb86a6a6e06c275414","author":{"email":"550518ab9d14bd32155907315f74849d7b5c2b36@gmail.com","name":"Jorge Aparicio"},"message":"remove the `Iterator` lang item","distinct":false,"url":"https://api.github.com/repos/rust-lang/rust/commits/d4b3e7f09c4d48685923aaeb86a6a6e06c275414"},{"sha":"cb896a6e5f0375d07b65d59fe57d46ab388d977c","author":{"email":"550518ab9d14bd32155907315f74849d7b5c2b36@gmail.com","name":"Jorge Aparicio"},"message":"fix recursive call","distinct":false,"url":"https://api.github.com/repos/rust-lang/rust/commits/cb896a6e5f0375d07b65d59fe57d46ab388d977c"},{"sha":"3a62590be2bc479a32eb3285dc1024041ac02a5b","author":{"email":"550518ab9d14bd32155907315f74849d7b5c2b36@gmail.com","name":"Jorge Aparicio"},"message":"add test for #20605\n\ncloses #20605\ncloses #20989 (duplicate)\ncloses #21379 (duplicate)","distinct":false,"url":"https://api.github.com/repos/rust-lang/rust/commits/3a62590be2bc479a32eb3285dc1024041ac02a5b"},{"sha":"c013a018b81c6beb14df172cebfd8c2e83da841b","author":{"email":"550518ab9d14bd32155907315f74849d7b5c2b36@gmail.com","name":"Jorge Aparicio"},"message":"add test for #21655\n\ncloses #21655","distinct":false,"url":"https://api.github.com/repos/rust-lang/rust/commits/c013a018b81c6beb14df172cebfd8c2e83da841b"},{"sha":"2d76c94dd077406d030a9b7058fb52f979db8bd2","author":{"email":"550518ab9d14bd32155907315f74849d7b5c2b36@gmail.com","name":"Jorge Aparicio"},"message":"s/while let/for/g now that #21245 has been fixed","distinct":false,"url":"https://api.github.com/repos/rust-lang/rust/commits/2d76c94dd077406d030a9b7058fb52f979db8bd2"},{"sha":"60abb3bef2242a8a8be960f2e563036753de336c","author":{"email":"550518ab9d14bd32155907315f74849d7b5c2b36@gmail.com","name":"Jorge Aparicio"},"message":"fixes after rebase","distinct":false,"url":"https://api.github.com/repos/rust-lang/rust/commits/60abb3bef2242a8a8be960f2e563036753de336c"},{"sha":"b9a9030ed68f135e116e9a5d32663e00b897cf4f","author":{"email":"550518ab9d14bd32155907315f74849d7b5c2b36@gmail.com","name":"Jorge Aparicio"},"message":"fix some cfail tests","distinct":false,"url":"https://api.github.com/repos/rust-lang/rust/commits/b9a9030ed68f135e116e9a5d32663e00b897cf4f"},{"sha":"56b0e324b031e7805ae182dd756fbbb7e1bdb95a","author":{"email":"3a2c29237f73c7cf88424b80e427b1884f346b35@rust-lang.org","name":"bors"},"message":"Auto merge of #20790 - japaric:for-loops, r=nikomatsakis\n\nAs per [RFC #235][rfc], you can now do:\r\n\r\n[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0235-collections-conventions.md#intoiterator-and-iterable\r\n\r\n``` rust\r\nlet mut v = vec![1];\r\n\r\n// iterate over immutable references\r\nfor x in &v {\r\n    assert_eq!(x, &1);\r\n}\r\n\r\n// iterate over mutable references\r\nfor x in &mut v {\r\n    assert_eq!(x, &mut 1);\r\n}\r\n\r\n// iterate over values, this consumes `v`\r\nfor x in v {\r\n    assert_eq!(x, 1);\r\n}\r\n```\r\n\r\n[breaking-change]s\r\n\r\nFor loops now \"consume\" (move) the iterator, this breaks iterating over mutable references to iterators, and also breaks multiple iterations over the same iterator:\r\n\r\n``` rust\r\nfn foo(mut it: &mut Iter) {  // `Iter` implements `Iterator`\r\n    for x in it { .. }  //~ error: `&mut Iter` doesn't implement Iterator\r\n}\r\n\r\nfn bar() {\r\n    for x in it { .. }  //~ note: `it` moved here\r\n    for x in it { .. }  //~ error: `it` has been moved\r\n}\r\n```\r\n\r\nBoth cases can be fixed using the `by_ref()` adapter to create an iterator from the mutable reference:\r\n\r\n``` rust\r\nfn foo(mut it: &mut Iter) {\r\n    for x in it.by_ref() { .. }\r\n}\r\n\r\nfn bar() {\r\n    for x in it.by_ref() { .. }\r\n    for x in it { .. }\r\n}\r\n```\r\n\r\nThis PR also makes iterator non-implicitly copyable, as this was source of subtle bugs in the libraries. You can still use `clone()` to explictly copy the iterator.\r\n\r\nFinally, since the for loops are implemented in the frontend and use global paths to `IntoIterator`, `Iterator` and `Option` variants, users of the `core` crate will have to use add an `std` module to the root of their crate to be able to use for loops:\r\n\r\n``` rust\r\n#![no_std]\r\n\r\nextern crate core;\r\n\r\nfn main() {\r\n    for x in 0..10 {}\r\n}\r\n\r\n#[doc(hidden)]\r\nmod std {\r\n    // these imports are needed to use for-loops\r\n    pub use core::iter;\r\n    pub use core::option;\r\n}\r\n```\r\n\r\n---\r\n\r\nr? @nikomatsakis @aturon \r\ncc #18424\r\ncloses #18045","distinct":false,"url":"https://api.github.com/repos/rust-lang/rust/commits/56b0e324b031e7805ae182dd756fbbb7e1bdb95a"}]}