diff options
| author | bors <bors@rust-lang.org> | 2017-07-15 14:51:02 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-07-15 14:51:02 +0000 |
| commit | a783fe2f77dfc69bdfbee539488403ff8883fd25 (patch) | |
| tree | 2f2b941613ea1aa7b2d62977052c3504f89398f7 /src/libcore | |
| parent | c4373bd6a29e4f68becfb0874f3199b8b0c2d482 (diff) | |
| parent | e3825ecd4c4e79eff77cb0c2ed51447a8a344ce0 (diff) | |
| download | rust-a783fe2f77dfc69bdfbee539488403ff8883fd25.tar.gz rust-a783fe2f77dfc69bdfbee539488403ff8883fd25.zip | |
Auto merge of #43246 - frewsxcv:rollup, r=frewsxcv
Rollup of 8 pull requests - Successful merges: #43074, #43145, #43159, #43202, #43222, #43228, #43229, #43240 - Failed merges:
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/iter/mod.rs | 8 | ||||
| -rw-r--r-- | src/libcore/ptr.rs | 5 | ||||
| -rw-r--r-- | src/libcore/str/mod.rs | 38 |
3 files changed, 50 insertions, 1 deletions
diff --git a/src/libcore/iter/mod.rs b/src/libcore/iter/mod.rs index decd718d65e..79e6b11beac 100644 --- a/src/libcore/iter/mod.rs +++ b/src/libcore/iter/mod.rs @@ -359,11 +359,19 @@ impl<I> Iterator for Rev<I> where I: DoubleEndedIterator { #[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() } + #[inline] fn find<P>(&mut self, predicate: P) -> Option<Self::Item> where P: FnMut(&Self::Item) -> bool { self.iter.rfind(predicate) } + + #[inline] + fn rposition<P>(&mut self, predicate: P) -> Option<usize> where + P: FnMut(Self::Item) -> bool + { + self.iter.position(predicate) + } } #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 92470299366..4f118f58441 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -160,7 +160,10 @@ unsafe fn swap_nonoverlapping_bytes(x: *mut u8, y: *mut u8, len: usize) { // #[repr(simd)], even if we don't actually use this struct directly. // // FIXME repr(simd) broken on emscripten and redox - #[cfg_attr(not(any(target_os = "emscripten", target_os = "redox")), repr(simd))] + // It's also broken on big-endian powerpc64 and s390x. #42778 + #[cfg_attr(not(any(target_os = "emscripten", target_os = "redox", + target_endian = "big")), + repr(simd))] struct Block(u64, u64, u64, u64); struct UnalignedBlock(u64, u64, u64, u64); diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 624c3638df5..3862b4a2eb0 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -710,6 +710,37 @@ impl<'a> Iterator for Bytes<'a> { fn nth(&mut self, n: usize) -> Option<Self::Item> { self.0.nth(n) } + + #[inline] + fn all<F>(&mut self, f: F) -> bool where F: FnMut(Self::Item) -> bool { + self.0.all(f) + } + + #[inline] + fn any<F>(&mut self, f: F) -> bool where F: FnMut(Self::Item) -> bool { + self.0.any(f) + } + + #[inline] + fn find<P>(&mut self, predicate: P) -> Option<Self::Item> where + P: FnMut(&Self::Item) -> bool + { + self.0.find(predicate) + } + + #[inline] + fn position<P>(&mut self, predicate: P) -> Option<usize> where + P: FnMut(Self::Item) -> bool + { + self.0.position(predicate) + } + + #[inline] + fn rposition<P>(&mut self, predicate: P) -> Option<usize> where + P: FnMut(Self::Item) -> bool + { + self.0.rposition(predicate) + } } #[stable(feature = "rust1", since = "1.0.0")] @@ -718,6 +749,13 @@ impl<'a> DoubleEndedIterator for Bytes<'a> { fn next_back(&mut self) -> Option<u8> { self.0.next_back() } + + #[inline] + fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item> where + P: FnMut(&Self::Item) -> bool + { + self.0.rfind(predicate) + } } #[stable(feature = "rust1", since = "1.0.0")] |
