Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 11 pull requests #37416

Closed
wants to merge 28 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
88b031e
save-analysis: dump data only if get_path_data doesn't fail to resolv…
eulerdisk Oct 13, 2016
4a93648
Support `use *;` and `use ::*;`.
jseyfried Oct 23, 2016
592d7bf
Add support for kernel randomness for Fuchsia
raphlinus Oct 24, 2016
c4651db
Support for aarch64 architecture on Fuchsia
raphlinus Oct 24, 2016
4bb6d4e
rustc_typeck: Allow reification from fn item to unsafe ptr
cramertj Oct 25, 2016
ab6119a
Fix coercin -> coercion typo
cramertj Oct 25, 2016
0a16a11
Use `SmallVector` for the stack in `macro_parser::parse`.
nnethercote Oct 21, 2016
3fd90d8
Use `SmallVector` for `TtReader::stack`.
nnethercote Oct 21, 2016
c440a7a
Don't use `Rc` in `TokenTreeOrTokenTreeVec`.
nnethercote Oct 21, 2016
15a9586
Special case .fold() for VecDeque's iterators
bluss Oct 25, 2016
780acda
iter: Implement .fold() for .cloned() and .map()
bluss Oct 25, 2016
b3e8c4c
Print out the error when HeapFree failures do occur
retep998 Oct 25, 2016
892a05d
run rustfmt on librustc_metadata folder
srinivasreddy Oct 22, 2016
09227b1
Vec docs: fix broken links and make quoting consistent
Oct 25, 2016
82d4200
Prohibit patterns in trait methods without bodies
petrochenkov Oct 22, 2016
a16626f
iter: Implement .fold() for .chain()
bluss Oct 25, 2016
1802610
Rollup merge of #37144 - eulerdisk:fix_37126, r=nrc
Manishearth Oct 26, 2016
e2bee0f
Rollup merge of #37315 - bluss:fold-more, r=alexcrichton
Manishearth Oct 26, 2016
5bc5647
Rollup merge of #37350 - srinivasreddy:meta_2, r=nrc
Manishearth Oct 26, 2016
9de7de8
Rollup merge of #37367 - jseyfried:import_crate_root, r=nrc
Manishearth Oct 26, 2016
f3882b0
Rollup merge of #37373 - nnethercote:html5ever-more-more, r=nrc
Manishearth Oct 26, 2016
f8d0a1f
Rollup merge of #37378 - petrochenkov:nopat, r=eddyb
Manishearth Oct 26, 2016
8b212e3
Rollup merge of #37385 - raphlinus:fuchsia_random, r=alexcrichton
Manishearth Oct 26, 2016
3fbfde5
Rollup merge of #37387 - raphlinus:fuchsia_aarch64, r=alexcrichton
Manishearth Oct 26, 2016
43a3a56
Rollup merge of #37389 - cramertj:cramertj/fn-item-to-unsafe-ptr, r=e…
Manishearth Oct 26, 2016
960f73b
Rollup merge of #37391 - vtduncan:vec-docs, r=GuillaumeGomez
Manishearth Oct 26, 2016
366d139
Rollup merge of #37399 - retep998:heap-of-trouble, r=alexcrichton
Manishearth Oct 26, 2016
d230a7e
Remove duplicate error code (fixup #37378)
Manishearth Oct 26, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/libcore/iter/mod.rs
Original file line number Diff line number Diff line change
@@ -399,6 +399,12 @@ impl<'a, I, T: 'a> Iterator for Cloned<I>
fn size_hint(&self) -> (usize, Option<usize>) {
self.it.size_hint()
}

fn fold<Acc, F>(self, init: Acc, mut f: F) -> Acc
where F: FnMut(Acc, Self::Item) -> Acc,
{
self.it.fold(init, move |acc, elt| f(acc, elt.clone()))
}
}

#[stable(feature = "iter_cloned", since = "1.1.0")]
@@ -939,6 +945,13 @@ impl<B, I: Iterator, F> Iterator for Map<I, F> where F: FnMut(I::Item) -> B {
fn size_hint(&self) -> (usize, Option<usize>) {
self.iter.size_hint()
}

fn fold<Acc, G>(self, init: Acc, mut g: G) -> Acc
where G: FnMut(Acc, Self::Item) -> Acc,
{
let mut f = self.f;
self.iter.fold(init, move |acc, elt| g(acc, f(elt)))
}
}

#[stable(feature = "rust1", since = "1.0.0")]