about summary refs log tree commit diff
path: root/src/libcore/str
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2015-01-10 11:54:15 -0500
committerNiko Matsakis <niko@alum.mit.edu>2015-01-28 05:15:23 -0500
commit07cdb853317697c247b41e61f7a429c3fb623524 (patch)
tree4b44f3fb2fa20220413aea7b6c844a5b99e9a196 /src/libcore/str
parentc61d7889b4bb270102dafe54cdfffbd737d168ff (diff)
downloadrust-07cdb853317697c247b41e61f7a429c3fb623524.tar.gz
rust-07cdb853317697c247b41e61f7a429c3fb623524.zip
Move return type an associated type of the `Fn*` traits. Mostly this involves tweaking things in
the compiler that assumed two input types to assume two ouputs; we also have to teach `project.rs`
to project `Output` from the unboxed closure and fn traits.
Diffstat (limited to 'src/libcore/str')
-rw-r--r--src/libcore/str/mod.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs
index 5b94733ea6f..101d349c351 100644
--- a/src/libcore/str/mod.rs
+++ b/src/libcore/str/mod.rs
@@ -461,6 +461,7 @@ delegate_iter!{exact u8 : Bytes<'a>}
 #[derive(Copy, Clone)]
 struct BytesDeref;
 
+#[cfg(stage0)]
 impl<'a> Fn(&'a u8) -> u8 for BytesDeref {
     #[inline]
     extern "rust-call" fn call(&self, (ptr,): (&'a u8,)) -> u8 {
@@ -468,6 +469,16 @@ impl<'a> Fn(&'a u8) -> u8 for BytesDeref {
     }
 }
 
+#[cfg(not(stage0))]
+impl<'a> Fn<(&'a u8,)> for BytesDeref {
+    type Output = u8;
+
+    #[inline]
+    extern "rust-call" fn call(&self, (ptr,): (&'a u8,)) -> u8 {
+        *ptr
+    }
+}
+
 /// An iterator over the substrings of a string, separated by `sep`.
 #[derive(Clone)]
 struct CharSplits<'a, Sep> {