about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-02-27 23:15:17 +0000
committerbors <bors@rust-lang.org>2015-02-27 23:15:17 +0000
commite233987ce1de88a48db2ce612019ba644d3cf5dd (patch)
treef776ae018199c9ff2350a29dc569630f64455f87 /src/libcore
parentbd0d8e47e53f25bbd50418a0f117973c366c1b08 (diff)
parentbde4c1d6fbefcd914a06b5eab6ef6f9a6f26f271 (diff)
downloadrust-e233987ce1de88a48db2ce612019ba644d3cf5dd.tar.gz
rust-e233987ce1de88a48db2ce612019ba644d3cf5dd.zip
Auto merge of #22860 - Manishearth:rollup, r=alexcrichton
Passes check-stage1, check-stage2
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/intrinsics.rs7
-rw-r--r--src/libcore/iter.rs9
-rw-r--r--src/libcore/marker.rs8
-rw-r--r--src/libcore/result.rs4
-rw-r--r--src/libcore/str/mod.rs1
5 files changed, 19 insertions, 10 deletions
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs
index e7af0be88a0..1ca243134cc 100644
--- a/src/libcore/intrinsics.rs
+++ b/src/libcore/intrinsics.rs
@@ -241,7 +241,12 @@ extern "rust-intrinsic" {
     /// will trigger a compiler error.
     pub fn return_address() -> *const u8;
 
-    /// Returns `true` if a type requires drop glue.
+    /// Returns `true` if the actual type given as `T` requires drop
+    /// glue; returns `false` if the actual type provided for `T`
+    /// implements `Copy`.
+    ///
+    /// If the actual type neither requires drop glue nor implements
+    /// `Copy`, then may return `true` or `false`.
     pub fn needs_drop<T>() -> bool;
 
     /// Returns `true` if a type is managed (will be allocated on the local heap)
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs
index 8f767e62678..94cc933d844 100644
--- a/src/libcore/iter.rs
+++ b/src/libcore/iter.rs
@@ -171,8 +171,7 @@ pub trait IteratorExt: Iterator + Sized {
         self.fold(0, |cnt, _x| cnt + 1)
     }
 
-    /// Loops through the entire iterator, returning the last element of the
-    /// iterator.
+    /// Loops through the entire iterator, returning the last element.
     ///
     /// # Examples
     ///
@@ -637,8 +636,8 @@ pub trait IteratorExt: Iterator + Sized {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn all<F>(self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool {
-        for x in self { if !f(x) { return false; } }
+    fn all<F>(&mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool {
+        for x in self.by_ref() { if !f(x) { return false; } }
         true
     }
 
@@ -1637,8 +1636,6 @@ impl<I: Iterator, P> Iterator for Filter<I, P> where P: FnMut(&I::Item) -> bool
         for x in self.iter.by_ref() {
             if (self.predicate)(&x) {
                 return Some(x);
-            } else {
-                continue
             }
         }
         None
diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs
index 6c934a998de..868a671b956 100644
--- a/src/libcore/marker.rs
+++ b/src/libcore/marker.rs
@@ -275,7 +275,13 @@ macro_rules! impls{
 /// any methods, but instead is used to gate access to data.
 ///
 /// FIXME. Better documentation needed here!
-pub trait MarkerTrait : PhantomFn<Self> { }
+pub trait MarkerTrait : PhantomFn<Self,Self> { }
+//                                    ~~~~~ <-- FIXME(#22806)?
+//
+// Marker trait has been made invariant so as to avoid inf recursion,
+// but we should ideally solve the underlying problem. That's a bit
+// complicated.
+
 impl<T:?Sized> MarkerTrait for T { }
 
 /// `PhantomFn` is a marker trait for use with traits that contain
diff --git a/src/libcore/result.rs b/src/libcore/result.rs
index bca73782491..b8271562d2e 100644
--- a/src/libcore/result.rs
+++ b/src/libcore/result.rs
@@ -641,9 +641,9 @@ impl<T, E> Result<T, E> {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn or(self, res: Result<T, E>) -> Result<T, E> {
+    pub fn or<F>(self, res: Result<T, F>) -> Result<T, F> {
         match self {
-            Ok(_) => self,
+            Ok(v) => Ok(v),
             Err(_) => res,
         }
     }
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs
index 7e51f8e8503..b354116993c 100644
--- a/src/libcore/str/mod.rs
+++ b/src/libcore/str/mod.rs
@@ -939,6 +939,7 @@ impl<'a, P: Pattern<'a>> Iterator for SplitStr<'a, P> {
     type Item = &'a str;
 
     #[inline]
+    #[allow(deprecated)]
     fn next(&mut self) -> Option<&'a str> {
         Iterator::next(&mut self.0)
     }