about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-08-27 19:35:44 -0700
committerbors <bors@rust-lang.org>2013-08-27 19:35:44 -0700
commit578e68047736167239c52fa1aba0347011ff1bc3 (patch)
tree00dfacbcaf5bcc846757d37cbf7e9309df699cb8 /src/libstd
parent32117132bdaf572bd4a156ec931579646e16d6f0 (diff)
parentaac9d6eee9a1e0b254bf6e035e2e14e5106758bd (diff)
downloadrust-578e68047736167239c52fa1aba0347011ff1bc3.tar.gz
rust-578e68047736167239c52fa1aba0347011ff1bc3.zip
auto merge of #8802 : pcwalton/rust/compile-speed, r=brson
r? @brson
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/at_vec.rs2
-rw-r--r--src/libstd/cast.rs5
-rw-r--r--src/libstd/cell.rs2
-rw-r--r--src/libstd/cleanup.rs4
-rw-r--r--src/libstd/fmt/mod.rs23
-rw-r--r--src/libstd/hashmap.rs6
-rw-r--r--src/libstd/iterator.rs10
-rw-r--r--src/libstd/logging.rs3
-rw-r--r--src/libstd/num/f32.rs179
-rw-r--r--src/libstd/num/f64.rs186
-rw-r--r--src/libstd/num/float.rs224
-rw-r--r--src/libstd/num/int_macros.rs9
-rw-r--r--src/libstd/num/num.rs24
-rw-r--r--src/libstd/num/uint_macros.rs9
-rw-r--r--src/libstd/os.rs2
-rw-r--r--src/libstd/ptr.rs146
-rw-r--r--src/libstd/rt/borrowck.rs39
-rw-r--r--src/libstd/rt/comm.rs6
-rw-r--r--src/libstd/rt/io/file.rs4
-rw-r--r--src/libstd/rt/io/net/ip.rs51
-rw-r--r--src/libstd/rt/io/net/tcp.rs4
-rw-r--r--src/libstd/rt/io/net/udp.rs5
-rw-r--r--src/libstd/rt/io/timer.rs2
-rw-r--r--src/libstd/rt/local.rs30
-rw-r--r--src/libstd/rt/local_heap.rs7
-rw-r--r--src/libstd/rt/mod.rs8
-rw-r--r--src/libstd/rt/sched.rs25
-rw-r--r--src/libstd/rt/select.rs1
-rw-r--r--src/libstd/rt/task.rs12
-rw-r--r--src/libstd/rt/tube.rs12
-rw-r--r--src/libstd/rt/uv/uvio.rs116
-rw-r--r--src/libstd/select.rs2
-rw-r--r--src/libstd/sys.rs4
-rw-r--r--src/libstd/task/local_data_priv.rs2
-rw-r--r--src/libstd/task/mod.rs12
-rw-r--r--src/libstd/task/spawn.rs10
-rw-r--r--src/libstd/to_bytes.rs9
-rw-r--r--src/libstd/tuple.rs2
-rw-r--r--src/libstd/unstable/atomics.rs3
-rw-r--r--src/libstd/unstable/lang.rs5
-rw-r--r--src/libstd/unstable/sync.rs3
-rw-r--r--src/libstd/util.rs6
-rw-r--r--src/libstd/vec.rs9
43 files changed, 783 insertions, 440 deletions
diff --git a/src/libstd/at_vec.rs b/src/libstd/at_vec.rs
index d001e2c6970..c192803efff 100644
--- a/src/libstd/at_vec.rs
+++ b/src/libstd/at_vec.rs
@@ -276,7 +276,7 @@ pub mod raw {
             use rt::local::Local;
             use rt::task::Task;
 
-            do Local::borrow::<Task, *()> |task| {
+            do Local::borrow |task: &mut Task| {
                 task.heap.realloc(ptr as *libc::c_void, size) as *()
             }
         }
diff --git a/src/libstd/cast.rs b/src/libstd/cast.rs
index 825d0147c80..a4e18d98f47 100644
--- a/src/libstd/cast.rs
+++ b/src/libstd/cast.rs
@@ -10,6 +10,7 @@
 
 //! Unsafe casting functions
 
+use ptr::RawPtr;
 use sys;
 use unstable::intrinsics;
 
@@ -94,13 +95,13 @@ pub unsafe fn transmute_region<'a,'b,T>(ptr: &'a T) -> &'b T {
 
 /// Coerce an immutable reference to be mutable.
 #[inline]
-pub unsafe fn transmute_mut_unsafe<T>(ptr: *const T) -> *mut T {
+pub unsafe fn transmute_mut_unsafe<T,P:RawPtr<T>>(ptr: P) -> *mut T {
     transmute(ptr)
 }
 
 /// Coerce an immutable reference to be mutable.
 #[inline]
-pub unsafe fn transmute_immut_unsafe<T>(ptr: *const T) -> *T {
+pub unsafe fn transmute_immut_unsafe<T,P:RawPtr<T>>(ptr: P) -> *T {
     transmute(ptr)
 }
 
diff --git a/src/libstd/cell.rs b/src/libstd/cell.rs
index f9f5b66acb6..a1459b780df 100644
--- a/src/libstd/cell.rs
+++ b/src/libstd/cell.rs
@@ -100,7 +100,7 @@ fn test_basic() {
 #[test]
 #[should_fail]
 fn test_take_empty() {
-    let value_cell = Cell::new_empty::<~int>();
+    let value_cell: Cell<~int> = Cell::new_empty();
     value_cell.take();
 }
 
diff --git a/src/libstd/cleanup.rs b/src/libstd/cleanup.rs
index 6a6ba12bae3..6b982ec75da 100644
--- a/src/libstd/cleanup.rs
+++ b/src/libstd/cleanup.rs
@@ -11,7 +11,7 @@
 #[doc(hidden)];
 
 use libc::c_void;
-use ptr::{mut_null};
+use ptr::null;
 use unstable::intrinsics::TyDesc;
 use unstable::raw;
 
@@ -37,7 +37,7 @@ unsafe fn each_live_alloc(read_next_before: bool,
     use rt::local_heap;
 
     let mut box = local_heap::live_allocs();
-    while box != mut_null() {
+    while box != null() {
         let next_before = (*box).next;
         let uniq = (*box).ref_count == managed::RC_MANAGED_UNIQUE;
 
diff --git a/src/libstd/fmt/mod.rs b/src/libstd/fmt/mod.rs
index daf8c4afb07..cdce69f7cd7 100644
--- a/src/libstd/fmt/mod.rs
+++ b/src/libstd/fmt/mod.rs
@@ -884,10 +884,17 @@ impl<T> Poly for T {
     }
 }
 
-// n.b. use 'const' to get an implementation for both '*mut' and '*' at the same
-//      time.
-impl<T> Pointer for *const T {
-    fn fmt(t: &*const T, f: &mut Formatter) {
+impl<T> Pointer for *T {
+    fn fmt(t: &*T, f: &mut Formatter) {
+        f.flags |= 1 << (parse::FlagAlternate as uint);
+        do ::uint::to_str_bytes(*t as uint, 16) |buf| {
+            f.pad_integral(buf, "0x", true);
+        }
+    }
+}
+
+impl<T> Pointer for *mut T {
+    fn fmt(t: &*mut T, f: &mut Formatter) {
         f.flags |= 1 << (parse::FlagAlternate as uint);
         do ::uint::to_str_bytes(*t as uint, 16) |buf| {
             f.pad_integral(buf, "0x", true);
@@ -923,8 +930,12 @@ delegate!(float to Float)
 delegate!(f32 to Float)
 delegate!(f64 to Float)
 
-impl<T> Default for *const T {
-    fn fmt(me: &*const T, f: &mut Formatter) { Pointer::fmt(me, f) }
+impl<T> Default for *T {
+    fn fmt(me: &*T, f: &mut Formatter) { Pointer::fmt(me, f) }
+}
+
+impl<T> Default for *mut T {
+    fn fmt(me: &*mut T, f: &mut Formatter) { Pointer::fmt(me, f) }
 }
 
 // If you expected tests to be here, look instead at the run-pass/ifmt.rs test,
diff --git a/src/libstd/hashmap.rs b/src/libstd/hashmap.rs
index 50e59cf438d..bcd658ece66 100644
--- a/src/libstd/hashmap.rs
+++ b/src/libstd/hashmap.rs
@@ -869,21 +869,21 @@ mod test_map {
 
     #[test]
     fn test_find_or_insert() {
-        let mut m = HashMap::new::<int, int>();
+        let mut m: HashMap<int,int> = HashMap::new();
         assert_eq!(*m.find_or_insert(1, 2), 2);
         assert_eq!(*m.find_or_insert(1, 3), 2);
     }
 
     #[test]
     fn test_find_or_insert_with() {
-        let mut m = HashMap::new::<int, int>();
+        let mut m: HashMap<int,int> = HashMap::new();
         assert_eq!(*m.find_or_insert_with(1, |_| 2), 2);
         assert_eq!(*m.find_or_insert_with(1, |_| 3), 2);
     }
 
     #[test]
     fn test_insert_or_update_with() {
-        let mut m = HashMap::new::<int, int>();
+        let mut m: HashMap<int,int> = HashMap::new();
         assert_eq!(*m.insert_or_update_with(1, 2, |_,x| *x+=1), 2);
         assert_eq!(*m.insert_or_update_with(1, 2, |_,x| *x+=1), 3);
     }
diff --git a/src/libstd/iterator.rs b/src/libstd/iterator.rs
index 1af49ecd208..4af7b3e2425 100644
--- a/src/libstd/iterator.rs
+++ b/src/libstd/iterator.rs
@@ -660,7 +660,10 @@ pub trait AdditiveIterator<A> {
 
 impl<A: Add<A, A> + Zero, T: Iterator<A>> AdditiveIterator<A> for T {
     #[inline]
-    fn sum(&mut self) -> A { self.fold(Zero::zero::<A>(), |s, x| s + x) }
+    fn sum(&mut self) -> A {
+        let zero: A = Zero::zero();
+        self.fold(zero, |s, x| s + x)
+    }
 }
 
 /// A trait for iterators over elements whose elements can be multiplied
@@ -685,7 +688,10 @@ pub trait MultiplicativeIterator<A> {
 
 impl<A: Mul<A, A> + One, T: Iterator<A>> MultiplicativeIterator<A> for T {
     #[inline]
-    fn product(&mut self) -> A { self.fold(One::one::<A>(), |p, x| p * x) }
+    fn product(&mut self) -> A {
+        let one: A = One::one();
+        self.fold(one, |p, x| p * x)
+    }
 }
 
 /// A trait for iterators over elements which can be compared to one another.
diff --git a/src/libstd/logging.rs b/src/libstd/logging.rs
index 7de55f48317..215067ea729 100644
--- a/src/libstd/logging.rs
+++ b/src/libstd/logging.rs
@@ -59,7 +59,8 @@ fn newsched_log_str(msg: ~str) {
     use rt::local::Local;
 
     unsafe {
-        match Local::try_unsafe_borrow::<Task>() {
+        let optional_task: Option<*mut Task> = Local::try_unsafe_borrow();
+        match optional_task {
             Some(local) => {
                 // Use the available logger
                 (*local).logger.log(Left(msg));
diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs
index a493dba467e..1c59eaf0219 100644
--- a/src/libstd/num/f32.rs
+++ b/src/libstd/num/f32.rs
@@ -182,7 +182,7 @@ impl ApproxEq<f32> for f32 {
 
     #[inline]
     fn approx_eq(&self, other: &f32) -> bool {
-        self.approx_eq_eps(other, &ApproxEq::approx_epsilon::<f32, f32>())
+        self.approx_eq_eps(other, &1.0e-6)
     }
 
     #[inline]
@@ -561,11 +561,14 @@ impl Real for f32 {
 
     /// Converts to degrees, assuming the number is in radians
     #[inline]
-    fn to_degrees(&self) -> f32 { *self * (180.0 / Real::pi::<f32>()) }
+    fn to_degrees(&self) -> f32 { *self * (180.0f32 / Real::pi()) }
 
     /// Converts to radians, assuming the number is in degrees
     #[inline]
-    fn to_radians(&self) -> f32 { *self * (Real::pi::<f32>() / 180.0) }
+    fn to_radians(&self) -> f32 {
+        let value: f32 = Real::pi();
+        *self * (value / 180.0f32)
+    }
 }
 
 impl Bounded for f32 {
@@ -578,10 +581,10 @@ impl Bounded for f32 {
 
 impl Primitive for f32 {
     #[inline]
-    fn bits() -> uint { 32 }
+    fn bits(_: Option<f32>) -> uint { 32 }
 
     #[inline]
-    fn bytes() -> uint { Primitive::bits::<f32>() / 8 }
+    fn bytes(_: Option<f32>) -> uint { Primitive::bits(Some(0f32)) / 8 }
 }
 
 impl Float for f32 {
@@ -638,25 +641,25 @@ impl Float for f32 {
     }
 
     #[inline]
-    fn mantissa_digits() -> uint { 24 }
+    fn mantissa_digits(_: Option<f32>) -> uint { 24 }
 
     #[inline]
-    fn digits() -> uint { 6 }
+    fn digits(_: Option<f32>) -> uint { 6 }
 
     #[inline]
     fn epsilon() -> f32 { 1.19209290e-07 }
 
     #[inline]
-    fn min_exp() -> int { -125 }
+    fn min_exp(_: Option<f32>) -> int { -125 }
 
     #[inline]
-    fn max_exp() -> int { 128 }
+    fn max_exp(_: Option<f32>) -> int { 128 }
 
     #[inline]
-    fn min_10_exp() -> int { -37 }
+    fn min_10_exp(_: Option<f32>) -> int { -37 }
 
     #[inline]
-    fn max_10_exp() -> int { 38 }
+    fn max_10_exp(_: Option<f32>) -> int { 38 }
 
     /// Constructs a floating point number by multiplying `x` by 2 raised to the power of `exp`
     #[inline]
@@ -949,9 +952,11 @@ mod tests {
         assert_eq!(1f32.clamp(&2f32, &4f32), 2f32);
         assert_eq!(8f32.clamp(&2f32, &4f32), 4f32);
         assert_eq!(3f32.clamp(&2f32, &4f32), 3f32);
-        assert!(3f32.clamp(&Float::NaN::<f32>(), &4f32).is_NaN());
-        assert!(3f32.clamp(&2f32, &Float::NaN::<f32>()).is_NaN());
-        assert!(Float::NaN::<f32>().clamp(&2f32, &4f32).is_NaN());
+
+        let nan: f32 = Float::NaN();
+        assert!(3f32.clamp(&nan, &4f32).is_NaN());
+        assert!(3f32.clamp(&2f32, &nan).is_NaN());
+        assert!(nan.clamp(&2f32, &4f32).is_NaN());
     }
 
     #[test]
@@ -1028,9 +1033,13 @@ mod tests {
     fn test_asinh() {
         assert_eq!(0.0f32.asinh(), 0.0f32);
         assert_eq!((-0.0f32).asinh(), -0.0f32);
-        assert_eq!(Float::infinity::<f32>().asinh(), Float::infinity::<f32>());
-        assert_eq!(Float::neg_infinity::<f32>().asinh(), Float::neg_infinity::<f32>());
-        assert!(Float::NaN::<f32>().asinh().is_NaN());
+
+        let inf: f32 = Float::infinity();
+        let neg_inf: f32 = Float::neg_infinity();
+        let nan: f32 = Float::NaN();
+        assert_eq!(inf.asinh(), inf);
+        assert_eq!(neg_inf.asinh(), neg_inf);
+        assert!(nan.asinh().is_NaN());
         assert_approx_eq!(2.0f32.asinh(), 1.443635475178810342493276740273105f32);
         assert_approx_eq!((-2.0f32).asinh(), -1.443635475178810342493276740273105f32);
     }
@@ -1039,9 +1048,13 @@ mod tests {
     fn test_acosh() {
         assert_eq!(1.0f32.acosh(), 0.0f32);
         assert!(0.999f32.acosh().is_NaN());
-        assert_eq!(Float::infinity::<f32>().acosh(), Float::infinity::<f32>());
-        assert!(Float::neg_infinity::<f32>().acosh().is_NaN());
-        assert!(Float::NaN::<f32>().acosh().is_NaN());
+
+        let inf: f32 = Float::infinity();
+        let neg_inf: f32 = Float::neg_infinity();
+        let nan: f32 = Float::NaN();
+        assert_eq!(inf.acosh(), inf);
+        assert!(neg_inf.acosh().is_NaN());
+        assert!(nan.acosh().is_NaN());
         assert_approx_eq!(2.0f32.acosh(), 1.31695789692481670862504634730796844f32);
         assert_approx_eq!(3.0f32.acosh(), 1.76274717403908605046521864995958461f32);
     }
@@ -1050,34 +1063,61 @@ mod tests {
     fn test_atanh() {
         assert_eq!(0.0f32.atanh(), 0.0f32);
         assert_eq!((-0.0f32).atanh(), -0.0f32);
-        assert_eq!(1.0f32.atanh(), Float::infinity::<f32>());
-        assert_eq!((-1.0f32).atanh(), Float::neg_infinity::<f32>());
+
+        let inf32: f32 = Float::infinity();
+        let neg_inf32: f32 = Float::neg_infinity();
+        assert_eq!(1.0f32.atanh(), inf32);
+        assert_eq!((-1.0f32).atanh(), neg_inf32);
+
         assert!(2f64.atanh().atanh().is_NaN());
         assert!((-2f64).atanh().atanh().is_NaN());
-        assert!(Float::infinity::<f64>().atanh().is_NaN());
-        assert!(Float::neg_infinity::<f64>().atanh().is_NaN());
-        assert!(Float::NaN::<f32>().atanh().is_NaN());
+
+        let inf64: f32 = Float::infinity();
+        let neg_inf64: f32 = Float::neg_infinity();
+        let nan32: f32 = Float::NaN();
+        assert!(inf64.atanh().is_NaN());
+        assert!(neg_inf64.atanh().is_NaN());
+        assert!(nan32.atanh().is_NaN());
+
         assert_approx_eq!(0.5f32.atanh(), 0.54930614433405484569762261846126285f32);
         assert_approx_eq!((-0.5f32).atanh(), -0.54930614433405484569762261846126285f32);
     }
 
     #[test]
     fn test_real_consts() {
-        assert_approx_eq!(Real::two_pi::<f32>(), 2f32 * Real::pi::<f32>());
-        assert_approx_eq!(Real::frac_pi_2::<f32>(), Real::pi::<f32>() / 2f32);
-        assert_approx_eq!(Real::frac_pi_3::<f32>(), Real::pi::<f32>() / 3f32);
-        assert_approx_eq!(Real::frac_pi_4::<f32>(), Real::pi::<f32>() / 4f32);
-        assert_approx_eq!(Real::frac_pi_6::<f32>(), Real::pi::<f32>() / 6f32);
-        assert_approx_eq!(Real::frac_pi_8::<f32>(), Real::pi::<f32>() / 8f32);
-        assert_approx_eq!(Real::frac_1_pi::<f32>(), 1f32 / Real::pi::<f32>());
-        assert_approx_eq!(Real::frac_2_pi::<f32>(), 2f32 / Real::pi::<f32>());
-        assert_approx_eq!(Real::frac_2_sqrtpi::<f32>(), 2f32 / Real::pi::<f32>().sqrt());
-        assert_approx_eq!(Real::sqrt2::<f32>(), 2f32.sqrt());
-        assert_approx_eq!(Real::frac_1_sqrt2::<f32>(), 1f32 / 2f32.sqrt());
-        assert_approx_eq!(Real::log2_e::<f32>(), Real::e::<f32>().log2());
-        assert_approx_eq!(Real::log10_e::<f32>(), Real::e::<f32>().log10());
-        assert_approx_eq!(Real::ln_2::<f32>(), 2f32.ln());
-        assert_approx_eq!(Real::ln_10::<f32>(), 10f32.ln());
+        let pi: f32 = Real::pi();
+        let two_pi: f32 = Real::two_pi();
+        let frac_pi_2: f32 = Real::frac_pi_2();
+        let frac_pi_3: f32 = Real::frac_pi_3();
+        let frac_pi_4: f32 = Real::frac_pi_4();
+        let frac_pi_6: f32 = Real::frac_pi_6();
+        let frac_pi_8: f32 = Real::frac_pi_8();
+        let frac_1_pi: f32 = Real::frac_1_pi();
+        let frac_2_pi: f32 = Real::frac_2_pi();
+        let frac_2_sqrtpi: f32 = Real::frac_2_sqrtpi();
+        let sqrt2: f32 = Real::sqrt2();
+        let frac_1_sqrt2: f32 = Real::frac_1_sqrt2();
+        let e: f32 = Real::e();
+        let log2_e: f32 = Real::log2_e();
+        let log10_e: f32 = Real::log10_e();
+        let ln_2: f32 = Real::ln_2();
+        let ln_10: f32 = Real::ln_10();
+
+        assert_approx_eq!(two_pi, 2f32 * pi);
+        assert_approx_eq!(frac_pi_2, pi / 2f32);
+        assert_approx_eq!(frac_pi_3, pi / 3f32);
+        assert_approx_eq!(frac_pi_4, pi / 4f32);
+        assert_approx_eq!(frac_pi_6, pi / 6f32);
+        assert_approx_eq!(frac_pi_8, pi / 8f32);
+        assert_approx_eq!(frac_1_pi, 1f32 / pi);
+        assert_approx_eq!(frac_2_pi, 2f32 / pi);
+        assert_approx_eq!(frac_2_sqrtpi, 2f32 / pi.sqrt());
+        assert_approx_eq!(sqrt2, 2f32.sqrt());
+        assert_approx_eq!(frac_1_sqrt2, 1f32 / 2f32.sqrt());
+        assert_approx_eq!(log2_e, e.log2());
+        assert_approx_eq!(log10_e, e.log10());
+        assert_approx_eq!(ln_2, 2f32.ln());
+        assert_approx_eq!(ln_10, 10f32.ln());
     }
 
     #[test]
@@ -1153,17 +1193,23 @@ mod tests {
 
     #[test]
     fn test_primitive() {
-        assert_eq!(Primitive::bits::<f32>(), sys::size_of::<f32>() * 8);
-        assert_eq!(Primitive::bytes::<f32>(), sys::size_of::<f32>());
+        let none: Option<f32> = None;
+        assert_eq!(Primitive::bits(none), sys::size_of::<f32>() * 8);
+        assert_eq!(Primitive::bytes(none), sys::size_of::<f32>());
     }
 
     #[test]
     fn test_is_normal() {
-        assert!(!Float::NaN::<f32>().is_normal());
-        assert!(!Float::infinity::<f32>().is_normal());
-        assert!(!Float::neg_infinity::<f32>().is_normal());
-        assert!(!Zero::zero::<f32>().is_normal());
-        assert!(!Float::neg_zero::<f32>().is_normal());
+        let nan: f32 = Float::NaN();
+        let inf: f32 = Float::infinity();
+        let neg_inf: f32 = Float::neg_infinity();
+        let zero: f32 = Zero::zero();
+        let neg_zero: f32 = Float::neg_zero();
+        assert!(!nan.is_normal());
+        assert!(!inf.is_normal());
+        assert!(!neg_inf.is_normal());
+        assert!(!zero.is_normal());
+        assert!(!neg_zero.is_normal());
         assert!(1f32.is_normal());
         assert!(1e-37f32.is_normal());
         assert!(!1e-38f32.is_normal());
@@ -1171,11 +1217,16 @@ mod tests {
 
     #[test]
     fn test_classify() {
-        assert_eq!(Float::NaN::<f32>().classify(), FPNaN);
-        assert_eq!(Float::infinity::<f32>().classify(), FPInfinite);
-        assert_eq!(Float::neg_infinity::<f32>().classify(), FPInfinite);
-        assert_eq!(Zero::zero::<f32>().classify(), FPZero);
-        assert_eq!(Float::neg_zero::<f32>().classify(), FPZero);
+        let nan: f32 = Float::NaN();
+        let inf: f32 = Float::infinity();
+        let neg_inf: f32 = Float::neg_infinity();
+        let zero: f32 = Zero::zero();
+        let neg_zero: f32 = Float::neg_zero();
+        assert_eq!(nan.classify(), FPNaN);
+        assert_eq!(inf.classify(), FPInfinite);
+        assert_eq!(neg_inf.classify(), FPInfinite);
+        assert_eq!(zero.classify(), FPZero);
+        assert_eq!(neg_zero.classify(), FPZero);
         assert_eq!(1f32.classify(), FPNormal);
         assert_eq!(1e-37f32.classify(), FPNormal);
         assert_eq!(1e-38f32.classify(), FPSubnormal);
@@ -1192,11 +1243,13 @@ mod tests {
 
         assert_eq!(Float::ldexp(0f32, -123), 0f32);
         assert_eq!(Float::ldexp(-0f32, -123), -0f32);
-        assert_eq!(Float::ldexp(Float::infinity::<f32>(), -123),
-                   Float::infinity::<f32>());
-        assert_eq!(Float::ldexp(Float::neg_infinity::<f32>(), -123),
-                   Float::neg_infinity::<f32>());
-        assert!(Float::ldexp(Float::NaN::<f32>(), -123).is_NaN());
+
+        let inf: f32 = Float::infinity();
+        let neg_inf: f32 = Float::neg_infinity();
+        let nan: f32 = Float::NaN();
+        assert_eq!(Float::ldexp(inf, -123), inf);
+        assert_eq!(Float::ldexp(neg_inf, -123), neg_inf);
+        assert!(Float::ldexp(nan, -123).is_NaN());
     }
 
     #[test]
@@ -1214,10 +1267,12 @@ mod tests {
 
         assert_eq!(0f32.frexp(), (0f32, 0));
         assert_eq!((-0f32).frexp(), (-0f32, 0));
-        assert_eq!(match Float::infinity::<f32>().frexp() { (x, _) => x },
-                   Float::infinity::<f32>())
-        assert_eq!(match Float::neg_infinity::<f32>().frexp() { (x, _) => x },
-                   Float::neg_infinity::<f32>())
-        assert!(match Float::NaN::<f32>().frexp() { (x, _) => x.is_NaN() })
+
+        let inf: f32 = Float::infinity();
+        let neg_inf: f32 = Float::neg_infinity();
+        let nan: f32 = Float::NaN();
+        assert_eq!(match inf.frexp() { (x, _) => x }, inf)
+        assert_eq!(match neg_inf.frexp() { (x, _) => x }, neg_inf)
+        assert!(match nan.frexp() { (x, _) => x.is_NaN() })
     }
 }
diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs
index 52e74d969eb..8f5d6473aea 100644
--- a/src/libstd/num/f64.rs
+++ b/src/libstd/num/f64.rs
@@ -205,7 +205,7 @@ impl ApproxEq<f64> for f64 {
 
     #[inline]
     fn approx_eq(&self, other: &f64) -> bool {
-        self.approx_eq_eps(other, &ApproxEq::approx_epsilon::<f64, f64>())
+        self.approx_eq_eps(other, &1.0e-6)
     }
 
     #[inline]
@@ -578,11 +578,14 @@ impl Real for f64 {
 
     /// Converts to degrees, assuming the number is in radians
     #[inline]
-    fn to_degrees(&self) -> f64 { *self * (180.0 / Real::pi::<f64>()) }
+    fn to_degrees(&self) -> f64 { *self * (180.0f64 / Real::pi()) }
 
     /// Converts to radians, assuming the number is in degrees
     #[inline]
-    fn to_radians(&self) -> f64 { *self * (Real::pi::<f64>() / 180.0) }
+    fn to_radians(&self) -> f64 {
+        let value: f64 = Real::pi();
+        *self * (value / 180.0)
+    }
 }
 
 impl RealExt for f64 {
@@ -625,10 +628,10 @@ impl Bounded for f64 {
 
 impl Primitive for f64 {
     #[inline]
-    fn bits() -> uint { 64 }
+    fn bits(_: Option<f64>) -> uint { 64 }
 
     #[inline]
-    fn bytes() -> uint { Primitive::bits::<f64>() / 8 }
+    fn bytes(_: Option<f64>) -> uint { Primitive::bits(Some(0f64)) / 8 }
 }
 
 impl Float for f64 {
@@ -685,25 +688,25 @@ impl Float for f64 {
     }
 
     #[inline]
-    fn mantissa_digits() -> uint { 53 }
+    fn mantissa_digits(_: Option<f64>) -> uint { 53 }
 
     #[inline]
-    fn digits() -> uint { 15 }
+    fn digits(_: Option<f64>) -> uint { 15 }
 
     #[inline]
     fn epsilon() -> f64 { 2.2204460492503131e-16 }
 
     #[inline]
-    fn min_exp() -> int { -1021 }
+    fn min_exp(_: Option<f64>) -> int { -1021 }
 
     #[inline]
-    fn max_exp() -> int { 1024 }
+    fn max_exp(_: Option<f64>) -> int { 1024 }
 
     #[inline]
-    fn min_10_exp() -> int { -307 }
+    fn min_10_exp(_: Option<f64>) -> int { -307 }
 
     #[inline]
-    fn max_10_exp() -> int { 308 }
+    fn max_10_exp(_: Option<f64>) -> int { 308 }
 
     /// Constructs a floating point number by multiplying `x` by 2 raised to the power of `exp`
     #[inline]
@@ -983,16 +986,20 @@ mod tests {
     fn test_min() {
         assert_eq!(1f64.min(&2f64), 1f64);
         assert_eq!(2f64.min(&1f64), 1f64);
-        assert!(1f64.min(&Float::NaN::<f64>()).is_NaN());
-        assert!(Float::NaN::<f64>().min(&1f64).is_NaN());
+
+        let nan: f64 = Float::NaN();
+        assert!(1f64.min(&nan).is_NaN());
+        assert!(nan.min(&1f64).is_NaN());
     }
 
     #[test]
     fn test_max() {
         assert_eq!(1f64.max(&2f64), 2f64);
         assert_eq!(2f64.max(&1f64), 2f64);
-        assert!(1f64.max(&Float::NaN::<f64>()).is_NaN());
-        assert!(Float::NaN::<f64>().max(&1f64).is_NaN());
+
+        let nan: f64 = Float::NaN();
+        assert!(1f64.max(&nan).is_NaN());
+        assert!(nan.max(&1f64).is_NaN());
     }
 
     #[test]
@@ -1000,9 +1007,11 @@ mod tests {
         assert_eq!(1f64.clamp(&2f64, &4f64), 2f64);
         assert_eq!(8f64.clamp(&2f64, &4f64), 4f64);
         assert_eq!(3f64.clamp(&2f64, &4f64), 3f64);
-        assert!(3f64.clamp(&Float::NaN::<f64>(), &4f64).is_NaN());
-        assert!(3f64.clamp(&2f64, &Float::NaN::<f64>()).is_NaN());
-        assert!(Float::NaN::<f64>().clamp(&2f64, &4f64).is_NaN());
+
+        let nan: f64 = Float::NaN();
+        assert!(3f64.clamp(&nan, &4f64).is_NaN());
+        assert!(3f64.clamp(&2f64, &nan).is_NaN());
+        assert!(nan.clamp(&2f64, &4f64).is_NaN());
     }
 
     #[test]
@@ -1079,9 +1088,13 @@ mod tests {
     fn test_asinh() {
         assert_eq!(0.0f64.asinh(), 0.0f64);
         assert_eq!((-0.0f64).asinh(), -0.0f64);
-        assert_eq!(Float::infinity::<f64>().asinh(), Float::infinity::<f64>());
-        assert_eq!(Float::neg_infinity::<f64>().asinh(), Float::neg_infinity::<f64>());
-        assert!(Float::NaN::<f64>().asinh().is_NaN());
+
+        let inf: f64 = Float::infinity();
+        let neg_inf: f64 = Float::neg_infinity();
+        let nan: f64 = Float::NaN();
+        assert_eq!(inf.asinh(), inf);
+        assert_eq!(neg_inf.asinh(), neg_inf);
+        assert!(nan.asinh().is_NaN());
         assert_approx_eq!(2.0f64.asinh(), 1.443635475178810342493276740273105f64);
         assert_approx_eq!((-2.0f64).asinh(), -1.443635475178810342493276740273105f64);
     }
@@ -1090,9 +1103,13 @@ mod tests {
     fn test_acosh() {
         assert_eq!(1.0f64.acosh(), 0.0f64);
         assert!(0.999f64.acosh().is_NaN());
-        assert_eq!(Float::infinity::<f64>().acosh(), Float::infinity::<f64>());
-        assert!(Float::neg_infinity::<f64>().acosh().is_NaN());
-        assert!(Float::NaN::<f64>().acosh().is_NaN());
+
+        let inf: f64 = Float::infinity();
+        let neg_inf: f64 = Float::neg_infinity();
+        let nan: f64 = Float::NaN();
+        assert_eq!(inf.acosh(), inf);
+        assert!(neg_inf.acosh().is_NaN());
+        assert!(nan.acosh().is_NaN());
         assert_approx_eq!(2.0f64.acosh(), 1.31695789692481670862504634730796844f64);
         assert_approx_eq!(3.0f64.acosh(), 1.76274717403908605046521864995958461f64);
     }
@@ -1101,34 +1118,56 @@ mod tests {
     fn test_atanh() {
         assert_eq!(0.0f64.atanh(), 0.0f64);
         assert_eq!((-0.0f64).atanh(), -0.0f64);
-        assert_eq!(1.0f64.atanh(), Float::infinity::<f64>());
-        assert_eq!((-1.0f64).atanh(), Float::neg_infinity::<f64>());
+
+        let inf: f64 = Float::infinity();
+        let neg_inf: f64 = Float::neg_infinity();
+        let nan: f64 = Float::NaN();
+        assert_eq!(1.0f64.atanh(), inf);
+        assert_eq!((-1.0f64).atanh(), neg_inf);
         assert!(2f64.atanh().atanh().is_NaN());
         assert!((-2f64).atanh().atanh().is_NaN());
-        assert!(Float::infinity::<f64>().atanh().is_NaN());
-        assert!(Float::neg_infinity::<f64>().atanh().is_NaN());
-        assert!(Float::NaN::<f64>().atanh().is_NaN());
+        assert!(inf.atanh().is_NaN());
+        assert!(neg_inf.atanh().is_NaN());
+        assert!(nan.atanh().is_NaN());
         assert_approx_eq!(0.5f64.atanh(), 0.54930614433405484569762261846126285f64);
         assert_approx_eq!((-0.5f64).atanh(), -0.54930614433405484569762261846126285f64);
     }
 
     #[test]
     fn test_real_consts() {
-        assert_approx_eq!(Real::two_pi::<f64>(), 2.0 * Real::pi::<f64>());
-        assert_approx_eq!(Real::frac_pi_2::<f64>(), Real::pi::<f64>() / 2f64);
-        assert_approx_eq!(Real::frac_pi_3::<f64>(), Real::pi::<f64>() / 3f64);
-        assert_approx_eq!(Real::frac_pi_4::<f64>(), Real::pi::<f64>() / 4f64);
-        assert_approx_eq!(Real::frac_pi_6::<f64>(), Real::pi::<f64>() / 6f64);
-        assert_approx_eq!(Real::frac_pi_8::<f64>(), Real::pi::<f64>() / 8f64);
-        assert_approx_eq!(Real::frac_1_pi::<f64>(), 1f64 / Real::pi::<f64>());
-        assert_approx_eq!(Real::frac_2_pi::<f64>(), 2f64 / Real::pi::<f64>());
-        assert_approx_eq!(Real::frac_2_sqrtpi::<f64>(), 2f64 / Real::pi::<f64>().sqrt());
-        assert_approx_eq!(Real::sqrt2::<f64>(), 2f64.sqrt());
-        assert_approx_eq!(Real::frac_1_sqrt2::<f64>(), 1f64 / 2f64.sqrt());
-        assert_approx_eq!(Real::log2_e::<f64>(), Real::e::<f64>().log2());
-        assert_approx_eq!(Real::log10_e::<f64>(), Real::e::<f64>().log10());
-        assert_approx_eq!(Real::ln_2::<f64>(), 2f64.ln());
-        assert_approx_eq!(Real::ln_10::<f64>(), 10f64.ln());
+        let pi: f64 = Real::pi();
+        let two_pi: f64 = Real::two_pi();
+        let frac_pi_2: f64 = Real::frac_pi_2();
+        let frac_pi_3: f64 = Real::frac_pi_3();
+        let frac_pi_4: f64 = Real::frac_pi_4();
+        let frac_pi_6: f64 = Real::frac_pi_6();
+        let frac_pi_8: f64 = Real::frac_pi_8();
+        let frac_1_pi: f64 = Real::frac_1_pi();
+        let frac_2_pi: f64 = Real::frac_2_pi();
+        let frac_2_sqrtpi: f64 = Real::frac_2_sqrtpi();
+        let sqrt2: f64 = Real::sqrt2();
+        let frac_1_sqrt2: f64 = Real::frac_1_sqrt2();
+        let e: f64 = Real::e();
+        let log2_e: f64 = Real::log2_e();
+        let log10_e: f64 = Real::log10_e();
+        let ln_2: f64 = Real::ln_2();
+        let ln_10: f64 = Real::ln_10();
+
+        assert_approx_eq!(two_pi, 2.0 * pi);
+        assert_approx_eq!(frac_pi_2, pi / 2f64);
+        assert_approx_eq!(frac_pi_3, pi / 3f64);
+        assert_approx_eq!(frac_pi_4, pi / 4f64);
+        assert_approx_eq!(frac_pi_6, pi / 6f64);
+        assert_approx_eq!(frac_pi_8, pi / 8f64);
+        assert_approx_eq!(frac_1_pi, 1f64 / pi);
+        assert_approx_eq!(frac_2_pi, 2f64 / pi);
+        assert_approx_eq!(frac_2_sqrtpi, 2f64 / pi.sqrt());
+        assert_approx_eq!(sqrt2, 2f64.sqrt());
+        assert_approx_eq!(frac_1_sqrt2, 1f64 / 2f64.sqrt());
+        assert_approx_eq!(log2_e, e.log2());
+        assert_approx_eq!(log10_e, e.log10());
+        assert_approx_eq!(ln_2, 2f64.ln());
+        assert_approx_eq!(ln_10, 10f64.ln());
     }
 
     #[test]
@@ -1204,17 +1243,23 @@ mod tests {
 
     #[test]
     fn test_primitive() {
-        assert_eq!(Primitive::bits::<f64>(), sys::size_of::<f64>() * 8);
-        assert_eq!(Primitive::bytes::<f64>(), sys::size_of::<f64>());
+        let none: Option<f64> = None;
+        assert_eq!(Primitive::bits(none), sys::size_of::<f64>() * 8);
+        assert_eq!(Primitive::bytes(none), sys::size_of::<f64>());
     }
 
     #[test]
     fn test_is_normal() {
-        assert!(!Float::NaN::<f64>().is_normal());
-        assert!(!Float::infinity::<f64>().is_normal());
-        assert!(!Float::neg_infinity::<f64>().is_normal());
-        assert!(!Zero::zero::<f64>().is_normal());
-        assert!(!Float::neg_zero::<f64>().is_normal());
+        let nan: f64 = Float::NaN();
+        let inf: f64 = Float::infinity();
+        let neg_inf: f64 = Float::neg_infinity();
+        let zero: f64 = Zero::zero();
+        let neg_zero: f64 = Float::neg_zero();
+        assert!(!nan.is_normal());
+        assert!(!inf.is_normal());
+        assert!(!neg_inf.is_normal());
+        assert!(!zero.is_normal());
+        assert!(!neg_zero.is_normal());
         assert!(1f64.is_normal());
         assert!(1e-307f64.is_normal());
         assert!(!1e-308f64.is_normal());
@@ -1222,11 +1267,16 @@ mod tests {
 
     #[test]
     fn test_classify() {
-        assert_eq!(Float::NaN::<f64>().classify(), FPNaN);
-        assert_eq!(Float::infinity::<f64>().classify(), FPInfinite);
-        assert_eq!(Float::neg_infinity::<f64>().classify(), FPInfinite);
-        assert_eq!(Zero::zero::<f64>().classify(), FPZero);
-        assert_eq!(Float::neg_zero::<f64>().classify(), FPZero);
+        let nan: f64 = Float::NaN();
+        let inf: f64 = Float::infinity();
+        let neg_inf: f64 = Float::neg_infinity();
+        let zero: f64 = Zero::zero();
+        let neg_zero: f64 = Float::neg_zero();
+        assert_eq!(nan.classify(), FPNaN);
+        assert_eq!(inf.classify(), FPInfinite);
+        assert_eq!(neg_inf.classify(), FPInfinite);
+        assert_eq!(zero.classify(), FPZero);
+        assert_eq!(neg_zero.classify(), FPZero);
         assert_eq!(1e-307f64.classify(), FPNormal);
         assert_eq!(1e-308f64.classify(), FPSubnormal);
     }
@@ -1242,11 +1292,13 @@ mod tests {
 
         assert_eq!(Float::ldexp(0f64, -123), 0f64);
         assert_eq!(Float::ldexp(-0f64, -123), -0f64);
-        assert_eq!(Float::ldexp(Float::infinity::<f64>(), -123),
-                   Float::infinity::<f64>());
-        assert_eq!(Float::ldexp(Float::neg_infinity::<f64>(), -123),
-                   Float::neg_infinity::<f64>());
-        assert!(Float::ldexp(Float::NaN::<f64>(), -123).is_NaN());
+
+        let inf: f64 = Float::infinity();
+        let neg_inf: f64 = Float::neg_infinity();
+        let nan: f64 = Float::NaN();
+        assert_eq!(Float::ldexp(inf, -123), inf);
+        assert_eq!(Float::ldexp(neg_inf, -123), neg_inf);
+        assert!(Float::ldexp(nan, -123).is_NaN());
     }
 
     #[test]
@@ -1264,10 +1316,12 @@ mod tests {
 
         assert_eq!(0f64.frexp(), (0f64, 0));
         assert_eq!((-0f64).frexp(), (-0f64, 0));
-        assert_eq!(match Float::infinity::<f64>().frexp() { (x, _) => x },
-                   Float::infinity::<f64>())
-        assert_eq!(match Float::neg_infinity::<f64>().frexp() { (x, _) => x },
-                   Float::neg_infinity::<f64>())
-        assert!(match Float::NaN::<f64>().frexp() { (x, _) => x.is_NaN() })
+
+        let inf: f64 = Float::infinity();
+        let neg_inf: f64 = Float::neg_infinity();
+        let nan: f64 = Float::NaN();
+        assert_eq!(match inf.frexp() { (x, _) => x }, inf)
+        assert_eq!(match neg_inf.frexp() { (x, _) => x }, neg_inf)
+        assert!(match nan.frexp() { (x, _) => x.is_NaN() })
     }
 }
diff --git a/src/libstd/num/float.rs b/src/libstd/num/float.rs
index 20c7adbd62c..d019de2468b 100644
--- a/src/libstd/num/float.rs
+++ b/src/libstd/num/float.rs
@@ -342,7 +342,7 @@ impl ApproxEq<float> for float {
 
     #[inline]
     fn approx_eq(&self, other: &float) -> bool {
-        self.approx_eq_eps(other, &ApproxEq::approx_epsilon::<float, float>())
+        self.approx_eq_eps(other, &1.0e-6)
     }
 
     #[inline]
@@ -783,32 +783,56 @@ impl Signed for float {
 
 impl Bounded for float {
     #[inline]
-    fn min_value() -> float { Bounded::min_value::<f64>() as float }
+    fn min_value() -> float {
+        let x: f64 = Bounded::min_value();
+        x as float
+    }
 
     #[inline]
-    fn max_value() -> float { Bounded::max_value::<f64>() as float }
+    fn max_value() -> float {
+        let x: f64 = Bounded::max_value();
+        x as float
+    }
 }
 
 impl Primitive for float {
     #[inline]
-    fn bits() -> uint { Primitive::bits::<f64>() }
+    fn bits(_: Option<float>) -> uint {
+        let bits: uint = Primitive::bits(Some(0f64));
+        bits
+    }
 
     #[inline]
-    fn bytes() -> uint { Primitive::bytes::<f64>() }
+    fn bytes(_: Option<float>) -> uint {
+        let bytes: uint = Primitive::bytes(Some(0f64));
+        bytes
+    }
 }
 
 impl Float for float {
     #[inline]
-    fn NaN() -> float { Float::NaN::<f64>() as float }
+    fn NaN() -> float {
+        let value: f64 = Float::NaN();
+        value as float
+    }
 
     #[inline]
-    fn infinity() -> float { Float::infinity::<f64>() as float }
+    fn infinity() -> float {
+        let value: f64 = Float::infinity();
+        value as float
+    }
 
     #[inline]
-    fn neg_infinity() -> float { Float::neg_infinity::<f64>() as float }
+    fn neg_infinity() -> float {
+        let value: f64 = Float::neg_infinity();
+        value as float
+    }
 
     #[inline]
-    fn neg_zero() -> float { Float::neg_zero::<f64>() as float }
+    fn neg_zero() -> float {
+        let value: f64 = Float::neg_zero();
+        value as float
+    }
 
     /// Returns `true` if the number is NaN
     #[inline]
@@ -832,30 +856,46 @@ impl Float for float {
     fn classify(&self) -> FPCategory { (*self as f64).classify() }
 
     #[inline]
-    fn mantissa_digits() -> uint { Float::mantissa_digits::<f64>() }
+    fn mantissa_digits(_: Option<float>) -> uint {
+        Float::mantissa_digits(Some(0f64))
+    }
 
     #[inline]
-    fn digits() -> uint { Float::digits::<f64>() }
+    fn digits(_: Option<float>) -> uint {
+        Float::digits(Some(0f64))
+    }
 
     #[inline]
-    fn epsilon() -> float { Float::epsilon::<f64>() as float }
+    fn epsilon() -> float {
+        let value: f64 = Float::epsilon();
+        value as float
+    }
 
     #[inline]
-    fn min_exp() -> int { Float::min_exp::<f64>() }
+    fn min_exp(_: Option<float>) -> int {
+        Float::min_exp(Some(0f64))
+    }
 
     #[inline]
-    fn max_exp() -> int { Float::max_exp::<f64>() }
+    fn max_exp(_: Option<float>) -> int {
+        Float::max_exp(Some(0f64))
+    }
 
     #[inline]
-    fn min_10_exp() -> int { Float::min_10_exp::<f64>() }
+    fn min_10_exp(_: Option<float>) -> int {
+        Float::min_10_exp(Some(0f64))
+    }
 
     #[inline]
-    fn max_10_exp() -> int { Float::max_10_exp::<f64>() }
+    fn max_10_exp(_: Option<float>) -> int {
+        Float::max_10_exp(Some(0f64))
+    }
 
     /// Constructs a floating point number by multiplying `x` by 2 raised to the power of `exp`
     #[inline]
     fn ldexp(x: float, exp: int) -> float {
-        Float::ldexp(x as f64, exp) as float
+        let value: f64 = Float::ldexp(x as f64, exp);
+        value as float
     }
 
     ///
@@ -937,9 +977,10 @@ mod tests {
         assert_eq!(1f.clamp(&2f, &4f), 2f);
         assert_eq!(8f.clamp(&2f, &4f), 4f);
         assert_eq!(3f.clamp(&2f, &4f), 3f);
-        assert!(3f.clamp(&Float::NaN::<float>(), &4f).is_NaN());
-        assert!(3f.clamp(&2f, &Float::NaN::<float>()).is_NaN());
-        assert!(Float::NaN::<float>().clamp(&2f, &4f).is_NaN());
+        let nan: float = Float::NaN();
+        assert!(3f.clamp(&nan, &4f).is_NaN());
+        assert!(3f.clamp(&2f, &nan).is_NaN());
+        assert!(nan.clamp(&2f, &4f).is_NaN());
     }
 
     #[test]
@@ -1016,9 +1057,13 @@ mod tests {
     fn test_asinh() {
         assert_eq!(0.0f.asinh(), 0.0f);
         assert_eq!((-0.0f).asinh(), -0.0f);
-        assert_eq!(Float::infinity::<float>().asinh(), Float::infinity::<float>());
-        assert_eq!(Float::neg_infinity::<float>().asinh(), Float::neg_infinity::<float>());
-        assert!(Float::NaN::<float>().asinh().is_NaN());
+
+        let inf: float = Float::infinity();
+        let neg_inf: float = Float::neg_infinity();
+        let nan: float = Float::NaN();
+        assert_eq!(inf.asinh(), inf);
+        assert_eq!(neg_inf.asinh(), neg_inf);
+        assert!(nan.asinh().is_NaN());
         assert_approx_eq!(2.0f.asinh(), 1.443635475178810342493276740273105f);
         assert_approx_eq!((-2.0f).asinh(), -1.443635475178810342493276740273105f);
     }
@@ -1027,9 +1072,13 @@ mod tests {
     fn test_acosh() {
         assert_eq!(1.0f.acosh(), 0.0f);
         assert!(0.999f.acosh().is_NaN());
-        assert_eq!(Float::infinity::<float>().acosh(), Float::infinity::<float>());
-        assert!(Float::neg_infinity::<float>().acosh().is_NaN());
-        assert!(Float::NaN::<float>().acosh().is_NaN());
+
+        let inf: float = Float::infinity();
+        let neg_inf: float = Float::neg_infinity();
+        let nan: float = Float::NaN();
+        assert_eq!(inf.acosh(), inf);
+        assert!(neg_inf.acosh().is_NaN());
+        assert!(nan.acosh().is_NaN());
         assert_approx_eq!(2.0f.acosh(), 1.31695789692481670862504634730796844f);
         assert_approx_eq!(3.0f.acosh(), 1.76274717403908605046521864995958461f);
     }
@@ -1038,34 +1087,58 @@ mod tests {
     fn test_atanh() {
         assert_eq!(0.0f.atanh(), 0.0f);
         assert_eq!((-0.0f).atanh(), -0.0f);
-        assert_eq!(1.0f.atanh(), Float::infinity::<float>());
-        assert_eq!((-1.0f).atanh(), Float::neg_infinity::<float>());
+
+        let inf: float = Float::infinity();
+        let neg_inf: float = Float::neg_infinity();
+        let inf64: f64 = Float::infinity();
+        let neg_inf64: f64 = Float::neg_infinity();
+        let nan: float = Float::NaN();
+        assert_eq!(1.0f.atanh(), inf);
+        assert_eq!((-1.0f).atanh(), neg_inf);
         assert!(2f64.atanh().atanh().is_NaN());
         assert!((-2f64).atanh().atanh().is_NaN());
-        assert!(Float::infinity::<f64>().atanh().is_NaN());
-        assert!(Float::neg_infinity::<f64>().atanh().is_NaN());
-        assert!(Float::NaN::<float>().atanh().is_NaN());
+        assert!(inf64.atanh().is_NaN());
+        assert!(neg_inf64.atanh().is_NaN());
+        assert!(nan.atanh().is_NaN());
         assert_approx_eq!(0.5f.atanh(), 0.54930614433405484569762261846126285f);
         assert_approx_eq!((-0.5f).atanh(), -0.54930614433405484569762261846126285f);
     }
 
     #[test]
     fn test_real_consts() {
-        assert_approx_eq!(Real::two_pi::<float>(), 2f * Real::pi::<float>());
-        assert_approx_eq!(Real::frac_pi_2::<float>(), Real::pi::<float>() / 2f);
-        assert_approx_eq!(Real::frac_pi_3::<float>(), Real::pi::<float>() / 3f);
-        assert_approx_eq!(Real::frac_pi_4::<float>(), Real::pi::<float>() / 4f);
-        assert_approx_eq!(Real::frac_pi_6::<float>(), Real::pi::<float>() / 6f);
-        assert_approx_eq!(Real::frac_pi_8::<float>(), Real::pi::<float>() / 8f);
-        assert_approx_eq!(Real::frac_1_pi::<float>(), 1f / Real::pi::<float>());
-        assert_approx_eq!(Real::frac_2_pi::<float>(), 2f / Real::pi::<float>());
-        assert_approx_eq!(Real::frac_2_sqrtpi::<float>(), 2f / Real::pi::<float>().sqrt());
-        assert_approx_eq!(Real::sqrt2::<float>(), 2f.sqrt());
-        assert_approx_eq!(Real::frac_1_sqrt2::<float>(), 1f / 2f.sqrt());
-        assert_approx_eq!(Real::log2_e::<float>(), Real::e::<float>().log2());
-        assert_approx_eq!(Real::log10_e::<float>(), Real::e::<float>().log10());
-        assert_approx_eq!(Real::ln_2::<float>(), 2f.ln());
-        assert_approx_eq!(Real::ln_10::<float>(), 10f.ln());
+        let pi: float = Real::pi();
+        let two_pi: float = Real::two_pi();
+        let frac_pi_2: float = Real::frac_pi_2();
+        let frac_pi_3: float = Real::frac_pi_3();
+        let frac_pi_4: float = Real::frac_pi_4();
+        let frac_pi_6: float = Real::frac_pi_6();
+        let frac_pi_8: float = Real::frac_pi_8();
+        let frac_1_pi: float = Real::frac_1_pi();
+        let frac_2_pi: float = Real::frac_2_pi();
+        let frac_2_sqrtpi: float = Real::frac_2_sqrtpi();
+        let sqrt2: float = Real::sqrt2();
+        let frac_1_sqrt2: float = Real::frac_1_sqrt2();
+        let e: float = Real::e();
+        let log2_e: float = Real::log2_e();
+        let log10_e: float = Real::log10_e();
+        let ln_2: float = Real::ln_2();
+        let ln_10: float = Real::ln_10();
+
+        assert_approx_eq!(two_pi, 2f * pi);
+        assert_approx_eq!(frac_pi_2, pi / 2f);
+        assert_approx_eq!(frac_pi_3, pi / 3f);
+        assert_approx_eq!(frac_pi_4, pi / 4f);
+        assert_approx_eq!(frac_pi_6, pi / 6f);
+        assert_approx_eq!(frac_pi_8, pi / 8f);
+        assert_approx_eq!(frac_1_pi, 1f / pi);
+        assert_approx_eq!(frac_2_pi, 2f / pi);
+        assert_approx_eq!(frac_2_sqrtpi, 2f / pi.sqrt());
+        assert_approx_eq!(sqrt2, 2f.sqrt());
+        assert_approx_eq!(frac_1_sqrt2, 1f / 2f.sqrt());
+        assert_approx_eq!(log2_e, e.log2());
+        assert_approx_eq!(log10_e, e.log10());
+        assert_approx_eq!(ln_2, 2f.ln());
+        assert_approx_eq!(ln_10, 10f.ln());
     }
 
     #[test]
@@ -1141,17 +1214,23 @@ mod tests {
 
     #[test]
     fn test_primitive() {
-        assert_eq!(Primitive::bits::<float>(), sys::size_of::<float>() * 8);
-        assert_eq!(Primitive::bytes::<float>(), sys::size_of::<float>());
+        let none: Option<float> = None;
+        assert_eq!(Primitive::bits(none), sys::size_of::<float>() * 8);
+        assert_eq!(Primitive::bytes(none), sys::size_of::<float>());
     }
 
     #[test]
     fn test_is_normal() {
-        assert!(!Float::NaN::<float>().is_normal());
-        assert!(!Float::infinity::<float>().is_normal());
-        assert!(!Float::neg_infinity::<float>().is_normal());
-        assert!(!Zero::zero::<float>().is_normal());
-        assert!(!Float::neg_zero::<float>().is_normal());
+        let nan: float = Float::NaN();
+        let inf: float = Float::infinity();
+        let neg_inf: float = Float::neg_infinity();
+        let zero: float = Zero::zero();
+        let neg_zero: float = Float::neg_zero();
+        assert!(!nan.is_normal());
+        assert!(!inf.is_normal());
+        assert!(!neg_inf.is_normal());
+        assert!(!zero.is_normal());
+        assert!(!neg_zero.is_normal());
         assert!(1f.is_normal());
         assert!(1e-307f.is_normal());
         assert!(!1e-308f.is_normal());
@@ -1159,11 +1238,16 @@ mod tests {
 
     #[test]
     fn test_classify() {
-        assert_eq!(Float::NaN::<float>().classify(), FPNaN);
-        assert_eq!(Float::infinity::<float>().classify(), FPInfinite);
-        assert_eq!(Float::neg_infinity::<float>().classify(), FPInfinite);
-        assert_eq!(Zero::zero::<float>().classify(), FPZero);
-        assert_eq!(Float::neg_zero::<float>().classify(), FPZero);
+        let nan: float = Float::NaN();
+        let inf: float = Float::infinity();
+        let neg_inf: float = Float::neg_infinity();
+        let zero: float = Zero::zero();
+        let neg_zero: float = Float::neg_zero();
+        assert_eq!(nan.classify(), FPNaN);
+        assert_eq!(inf.classify(), FPInfinite);
+        assert_eq!(neg_inf.classify(), FPInfinite);
+        assert_eq!(zero.classify(), FPZero);
+        assert_eq!(neg_zero.classify(), FPZero);
         assert_eq!(1f.classify(), FPNormal);
         assert_eq!(1e-307f.classify(), FPNormal);
         assert_eq!(1e-308f.classify(), FPSubnormal);
@@ -1180,11 +1264,13 @@ mod tests {
 
         assert_eq!(Float::ldexp(0f, -123), 0f);
         assert_eq!(Float::ldexp(-0f, -123), -0f);
-        assert_eq!(Float::ldexp(Float::infinity::<float>(), -123),
-                   Float::infinity::<float>());
-        assert_eq!(Float::ldexp(Float::neg_infinity::<float>(), -123),
-                   Float::neg_infinity::<float>());
-        assert!(Float::ldexp(Float::NaN::<float>(), -123).is_NaN());
+
+        let inf: float = Float::infinity();
+        let neg_inf: float = Float::neg_infinity();
+        let nan: float = Float::NaN();
+        assert_eq!(Float::ldexp(inf, -123), inf);
+        assert_eq!(Float::ldexp(neg_inf, -123), neg_inf);
+        assert!(Float::ldexp(nan, -123).is_NaN());
     }
 
     #[test]
@@ -1202,11 +1288,13 @@ mod tests {
 
         assert_eq!(0f.frexp(), (0f, 0));
         assert_eq!((-0f).frexp(), (-0f, 0));
-        assert_eq!(match Float::infinity::<float>().frexp() { (x, _) => x },
-                   Float::infinity::<float>())
-        assert_eq!(match Float::neg_infinity::<float>().frexp() { (x, _) => x },
-                   Float::neg_infinity::<float>())
-        assert!(match Float::NaN::<float>().frexp() { (x, _) => x.is_NaN() })
+
+        let inf: float = Float::infinity();
+        let neg_inf: float = Float::neg_infinity();
+        let nan: float = Float::NaN();
+        assert_eq!(match inf.frexp() { (x, _) => x }, inf);
+        assert_eq!(match neg_inf.frexp() { (x, _) => x }, neg_inf);
+        assert!(match nan.frexp() { (x, _) => x.is_NaN() })
     }
 
     #[test]
diff --git a/src/libstd/num/int_macros.rs b/src/libstd/num/int_macros.rs
index e2218ce2736..6054d557fa5 100644
--- a/src/libstd/num/int_macros.rs
+++ b/src/libstd/num/int_macros.rs
@@ -466,10 +466,10 @@ impl Int for $T {}
 
 impl Primitive for $T {
     #[inline]
-    fn bits() -> uint { bits }
+    fn bits(_: Option<$T>) -> uint { bits }
 
     #[inline]
-    fn bytes() -> uint { bits / 8 }
+    fn bytes(_: Option<$T>) -> uint { bits / 8 }
 }
 
 // String conversion functions and impl str -> num
@@ -754,8 +754,9 @@ mod tests {
 
     #[test]
     fn test_primitive() {
-        assert_eq!(Primitive::bits::<$T>(), sys::size_of::<$T>() * 8);
-        assert_eq!(Primitive::bytes::<$T>(), sys::size_of::<$T>());
+        let none: Option<$T> = None;
+        assert_eq!(Primitive::bits(none), sys::size_of::<$T>() * 8);
+        assert_eq!(Primitive::bytes(none), sys::size_of::<$T>());
     }
 
     #[test]
diff --git a/src/libstd/num/num.rs b/src/libstd/num/num.rs
index fbb8913fbfa..80ab0caac67 100644
--- a/src/libstd/num/num.rs
+++ b/src/libstd/num/num.rs
@@ -272,8 +272,8 @@ pub trait Primitive: Num
                    + Div<Self,Self>
                    + Rem<Self,Self> {
     // FIXME (#5527): These should be associated constants
-    fn bits() -> uint;
-    fn bytes() -> uint;
+    fn bits(unused_self: Option<Self>) -> uint;
+    fn bytes(unused_self: Option<Self>) -> uint;
 }
 
 /// A collection of traits relevant to primitive signed and unsigned integers
@@ -314,13 +314,13 @@ pub trait Float: Real
     fn is_normal(&self) -> bool;
     fn classify(&self) -> FPCategory;
 
-    fn mantissa_digits() -> uint;
-    fn digits() -> uint;
+    fn mantissa_digits(unused_self: Option<Self>) -> uint;
+    fn digits(unused_self: Option<Self>) -> uint;
     fn epsilon() -> Self;
-    fn min_exp() -> int;
-    fn max_exp() -> int;
-    fn min_10_exp() -> int;
-    fn max_10_exp() -> int;
+    fn min_exp(unused_self: Option<Self>) -> int;
+    fn max_exp(unused_self: Option<Self>) -> int;
+    fn min_10_exp(unused_self: Option<Self>) -> int;
+    fn max_10_exp(unused_self: Option<Self>) -> int;
 
     fn ldexp(x: Self, exp: int) -> Self;
     fn frexp(&self) -> (Self, int);
@@ -484,9 +484,9 @@ impl<T: CheckedAdd+CheckedSub+Zero+Ord+Bounded> Saturating for T {
         match self.checked_add(&v) {
             Some(x) => x,
             None => if v >= Zero::zero() {
-                Bounded::max_value::<T>()
+                Bounded::max_value()
             } else {
-                Bounded::min_value::<T>()
+                Bounded::min_value()
             }
         }
     }
@@ -496,9 +496,9 @@ impl<T: CheckedAdd+CheckedSub+Zero+Ord+Bounded> Saturating for T {
         match self.checked_sub(&v) {
             Some(x) => x,
             None => if v >= Zero::zero() {
-                Bounded::min_value::<T>()
+                Bounded::min_value()
             } else {
-                Bounded::max_value::<T>()
+                Bounded::max_value()
             }
         }
     }
diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs
index d81a2756ad8..8ffaed22d01 100644
--- a/src/libstd/num/uint_macros.rs
+++ b/src/libstd/num/uint_macros.rs
@@ -404,10 +404,10 @@ impl ToStrRadix for $T {
 
 impl Primitive for $T {
     #[inline]
-    fn bits() -> uint { bits }
+    fn bits(_: Option<$T>) -> uint { bits }
 
     #[inline]
-    fn bytes() -> uint { bits / 8 }
+    fn bytes(_: Option<$T>) -> uint { bits / 8 }
 }
 
 impl BitCount for $T {
@@ -532,8 +532,9 @@ mod tests {
 
     #[test]
     fn test_primitive() {
-        assert_eq!(Primitive::bits::<$T>(), sys::size_of::<$T>() * 8);
-        assert_eq!(Primitive::bytes::<$T>(), sys::size_of::<$T>());
+        let none: Option<$T> = None;
+        assert_eq!(Primitive::bits(none), sys::size_of::<$T>() * 8);
+        assert_eq!(Primitive::bytes(none), sys::size_of::<$T>());
     }
 
     #[test]
diff --git a/src/libstd/os.rs b/src/libstd/os.rs
index e7caf3f23ab..7aae9425302 100644
--- a/src/libstd/os.rs
+++ b/src/libstd/os.rs
@@ -1521,7 +1521,7 @@ impl MemoryMap {
         let r = unsafe {
             libc::mmap(addr, len, prot, flags, fd, offset)
         };
-        if r == libc::MAP_FAILED {
+        if r.equiv(&libc::MAP_FAILED) {
             Err(match errno() as c_int {
                 libc::EACCES => ErrFdNotAvail,
                 libc::EBADF => ErrInvalidFd,
diff --git a/src/libstd/ptr.rs b/src/libstd/ptr.rs
index 12af303f33f..860b1f4b768 100644
--- a/src/libstd/ptr.rs
+++ b/src/libstd/ptr.rs
@@ -12,8 +12,11 @@
 
 use cast;
 use clone::Clone;
+use cmp::Equiv;
 use iterator::{range, Iterator};
 use option::{Option, Some, None};
+#[cfg(stage0)]
+use sys;
 use unstable::intrinsics;
 use util::swap;
 
@@ -24,18 +27,28 @@ use util::swap;
 
 /// Calculate the offset from a pointer
 #[inline]
+#[cfg(stage0)]
 pub fn offset<T>(ptr: *T, count: int) -> *T {
-    unsafe { intrinsics::offset(ptr, count) }
+    (ptr as uint + (count as uint) * sys::size_of::<T>()) as *T
 }
 
-/// Calculate the offset from a const pointer
+/// Calculate the offset from a mut pointer
 #[inline]
-pub fn const_offset<T>(ptr: *const T, count: int) -> *const T {
-    unsafe { intrinsics::offset(ptr as *T, count) }
+#[cfg(stage0)]
+pub fn mut_offset<T>(ptr: *mut T, count: int) -> *mut T {
+    (ptr as uint + (count as uint) * sys::size_of::<T>()) as *mut T
+}
+
+/// Calculate the offset from a pointer
+#[inline]
+#[cfg(not(stage0))]
+pub fn offset<T>(ptr: *T, count: int) -> *T {
+    unsafe { intrinsics::offset(ptr, count) }
 }
 
 /// Calculate the offset from a mut pointer
 #[inline]
+#[cfg(not(stage0))]
 pub fn mut_offset<T>(ptr: *mut T, count: int) -> *mut T {
     unsafe { intrinsics::offset(ptr as *T, count) as *mut T }
 }
@@ -73,11 +86,11 @@ pub fn mut_null<T>() -> *mut T { 0 as *mut T }
 
 /// Returns true if the pointer is equal to the null pointer.
 #[inline]
-pub fn is_null<T>(ptr: *const T) -> bool { ptr == null() }
+pub fn is_null<T,P:RawPtr<T>>(ptr: P) -> bool { ptr.is_null() }
 
 /// Returns true if the pointer is not equal to the null pointer.
 #[inline]
-pub fn is_not_null<T>(ptr: *const T) -> bool { !is_null(ptr) }
+pub fn is_not_null<T,P:RawPtr<T>>(ptr: P) -> bool { ptr.is_not_null() }
 
 /**
  * Copies data from one location to another.
@@ -87,8 +100,10 @@ pub fn is_not_null<T>(ptr: *const T) -> bool { !is_null(ptr) }
  */
 #[inline]
 #[cfg(target_word_size = "32")]
-pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
-    intrinsics::memmove32(dst, src as *T, count as u32);
+pub unsafe fn copy_memory<T,P:RawPtr<T>>(dst: *mut T, src: P, count: uint) {
+    intrinsics::memmove32(dst,
+                          cast::transmute_immut_unsafe(src),
+                          count as u32);
 }
 
 /**
@@ -99,8 +114,10 @@ pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
  */
 #[inline]
 #[cfg(target_word_size = "64")]
-pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
-    intrinsics::memmove64(dst, src as *T, count as u64);
+pub unsafe fn copy_memory<T,P:RawPtr<T>>(dst: *mut T, src: P, count: uint) {
+    intrinsics::memmove64(dst,
+                          cast::transmute_immut_unsafe(src),
+                          count as u64);
 }
 
 /**
@@ -111,8 +128,12 @@ pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
  */
 #[inline]
 #[cfg(target_word_size = "32")]
-pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: uint) {
-    intrinsics::memcpy32(dst, src as *T, count as u32);
+pub unsafe fn copy_nonoverlapping_memory<T,P:RawPtr<T>>(dst: *mut T,
+                                                        src: P,
+                                                        count: uint) {
+    intrinsics::memcpy32(dst,
+                         cast::transmute_immut_unsafe(src),
+                         count as u32);
 }
 
 /**
@@ -123,8 +144,12 @@ pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: u
  */
 #[inline]
 #[cfg(target_word_size = "64")]
-pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: uint) {
-    intrinsics::memcpy64(dst, src as *T, count as u64);
+pub unsafe fn copy_nonoverlapping_memory<T,P:RawPtr<T>>(dst: *mut T,
+                                                        src: P,
+                                                        count: uint) {
+    intrinsics::memcpy64(dst,
+                         cast::transmute_immut_unsafe(src),
+                         count as u64);
 }
 
 /**
@@ -216,12 +241,6 @@ pub fn to_unsafe_ptr<T>(thing: &T) -> *T {
     thing as *T
 }
 
-/// Transform a const region pointer - &const T - to a const unsafe pointer - *const T.
-#[inline]
-pub fn to_const_unsafe_ptr<T>(thing: &const T) -> *const T {
-    thing as *const T
-}
-
 /// Transform a mutable region pointer - &mut T - to a mutable unsafe pointer - *mut T.
 #[inline]
 pub fn to_mut_unsafe_ptr<T>(thing: &mut T) -> *mut T {
@@ -269,8 +288,10 @@ pub unsafe fn array_each<T>(arr: **T, cb: &fn(*T)) {
 
 #[allow(missing_doc)]
 pub trait RawPtr<T> {
+    fn null() -> Self;
     fn is_null(&self) -> bool;
     fn is_not_null(&self) -> bool;
+    fn to_uint(&self) -> uint;
     unsafe fn to_option(&self) -> Option<&T>;
     fn offset(&self, count: int) -> Self;
     unsafe fn offset_inbounds(self, count: int) -> Self;
@@ -278,13 +299,21 @@ pub trait RawPtr<T> {
 
 /// Extension methods for immutable pointers
 impl<T> RawPtr<T> for *T {
+    /// Returns the null pointer.
+    #[inline]
+    fn null() -> *T { null() }
+
     /// Returns true if the pointer is equal to the null pointer.
     #[inline]
-    fn is_null(&self) -> bool { is_null(*self) }
+    fn is_null(&self) -> bool { *self == RawPtr::null() }
 
     /// Returns true if the pointer is not equal to the null pointer.
     #[inline]
-    fn is_not_null(&self) -> bool { is_not_null(*self) }
+    fn is_not_null(&self) -> bool { *self != RawPtr::null() }
+
+    /// Returns the address of this pointer.
+    #[inline]
+    fn to_uint(&self) -> uint { *self as uint }
 
     ///
     /// Returns `None` if the pointer is null, or else returns the value wrapped
@@ -317,13 +346,21 @@ impl<T> RawPtr<T> for *T {
 
 /// Extension methods for mutable pointers
 impl<T> RawPtr<T> for *mut T {
+    /// Returns the null pointer.
+    #[inline]
+    fn null() -> *mut T { mut_null() }
+
     /// Returns true if the pointer is equal to the null pointer.
     #[inline]
-    fn is_null(&self) -> bool { is_null(*self) }
+    fn is_null(&self) -> bool { *self == RawPtr::null() }
 
     /// Returns true if the pointer is not equal to the null pointer.
     #[inline]
-    fn is_not_null(&self) -> bool { is_not_null(*self) }
+    fn is_not_null(&self) -> bool { *self != RawPtr::null() }
+
+    /// Returns the address of this pointer.
+    #[inline]
+    fn to_uint(&self) -> uint { *self as uint }
 
     ///
     /// Returns `None` if the pointer is null, or else returns the value wrapped
@@ -360,13 +397,38 @@ impl<T> RawPtr<T> for *mut T {
 
 // Equality for pointers
 #[cfg(not(test))]
-impl<T> Eq for *const T {
+impl<T> Eq for *T {
+    #[inline]
+    fn eq(&self, other: &*T) -> bool {
+        (*self as uint) == (*other as uint)
+    }
+    #[inline]
+    fn ne(&self, other: &*T) -> bool { !self.eq(other) }
+}
+
+#[cfg(not(test))]
+impl<T> Eq for *mut T {
     #[inline]
-    fn eq(&self, other: &*const T) -> bool {
+    fn eq(&self, other: &*mut T) -> bool {
         (*self as uint) == (*other as uint)
     }
     #[inline]
-    fn ne(&self, other: &*const T) -> bool { !self.eq(other) }
+    fn ne(&self, other: &*mut T) -> bool { !self.eq(other) }
+}
+
+// Equivalence for pointers
+#[cfg(not(test))]
+impl<T> Equiv<*mut T> for *T {
+    fn equiv(&self, other: &*mut T) -> bool {
+        self.to_uint() == other.to_uint()
+    }
+}
+
+#[cfg(not(test))]
+impl<T> Equiv<*T> for *mut T {
+    fn equiv(&self, other: &*T) -> bool {
+        self.to_uint() == other.to_uint()
+    }
 }
 
 // Equality for extern "C" fn pointers
@@ -412,21 +474,41 @@ mod externfnpointers {
 
 // Comparison for pointers
 #[cfg(not(test))]
-impl<T> Ord for *const T {
+impl<T> Ord for *T {
+    #[inline]
+    fn lt(&self, other: &*T) -> bool {
+        (*self as uint) < (*other as uint)
+    }
+    #[inline]
+    fn le(&self, other: &*T) -> bool {
+        (*self as uint) <= (*other as uint)
+    }
+    #[inline]
+    fn ge(&self, other: &*T) -> bool {
+        (*self as uint) >= (*other as uint)
+    }
+    #[inline]
+    fn gt(&self, other: &*T) -> bool {
+        (*self as uint) > (*other as uint)
+    }
+}
+
+#[cfg(not(test))]
+impl<T> Ord for *mut T {
     #[inline]
-    fn lt(&self, other: &*const T) -> bool {
+    fn lt(&self, other: &*mut T) -> bool {
         (*self as uint) < (*other as uint)
     }
     #[inline]
-    fn le(&self, other: &*const T) -> bool {
+    fn le(&self, other: &*mut T) -> bool {
         (*self as uint) <= (*other as uint)
     }
     #[inline]
-    fn ge(&self, other: &*const T) -> bool {
+    fn ge(&self, other: &*mut T) -> bool {
         (*self as uint) >= (*other as uint)
     }
     #[inline]
-    fn gt(&self, other: &*const T) -> bool {
+    fn gt(&self, other: &*mut T) -> bool {
         (*self as uint) > (*other as uint)
     }
 }
diff --git a/src/libstd/rt/borrowck.rs b/src/libstd/rt/borrowck.rs
index cbac43f27c7..9dc0abdfbd8 100644
--- a/src/libstd/rt/borrowck.rs
+++ b/src/libstd/rt/borrowck.rs
@@ -11,17 +11,18 @@
 use cell::Cell;
 use c_str::ToCStr;
 use cast::transmute;
-use libc::{c_char, size_t, STDERR_FILENO};
-use io;
 use io::{Writer, WriterUtil};
+use io;
+use libc::{c_char, size_t, STDERR_FILENO};
 use option::{Option, None, Some};
-use uint;
+use ptr::RawPtr;
 use rt::env;
 use rt::local::Local;
 use rt::task::Task;
-use str;
 use str::{OwnedStr, StrSlice};
+use str;
 use sys;
+use uint;
 use unstable::raw;
 use vec::ImmutableVector;
 
@@ -37,7 +38,7 @@ pub struct BorrowRecord {
 }
 
 fn try_take_task_borrow_list() -> Option<~[BorrowRecord]> {
-    do Local::borrow::<Task, Option<~[BorrowRecord]>> |task| {
+    do Local::borrow |task: &mut Task| {
         task.borrow_list.take()
     }
 }
@@ -49,7 +50,7 @@ fn swap_task_borrow_list(f: &fn(~[BorrowRecord]) -> ~[BorrowRecord]) {
     };
     let borrows = f(borrows);
     let borrows = Cell::new(borrows);
-    do Local::borrow::<Task, ()> |task| {
+    do Local::borrow |task: &mut Task| {
         task.borrow_list = Some(borrows.take());
     }
 }
@@ -93,12 +94,12 @@ unsafe fn fail_borrowed(box: *mut raw::Box<()>, file: *c_char, line: size_t) {
 static ENABLE_DEBUG: bool = false;
 
 #[inline]
-unsafe fn debug_borrow<T>(tag: &'static str,
-                          p: *const T,
-                          old_bits: uint,
-                          new_bits: uint,
-                          filename: *c_char,
-                          line: size_t) {
+unsafe fn debug_borrow<T,P:RawPtr<T>>(tag: &'static str,
+                                      p: P,
+                                      old_bits: uint,
+                                      new_bits: uint,
+                                      filename: *c_char,
+                                      line: size_t) {
     //! A useful debugging function that prints a pointer + tag + newline
     //! without allocating memory.
 
@@ -106,15 +107,15 @@ unsafe fn debug_borrow<T>(tag: &'static str,
         debug_borrow_slow(tag, p, old_bits, new_bits, filename, line);
     }
 
-    unsafe fn debug_borrow_slow<T>(tag: &'static str,
-                                   p: *const T,
-                                   old_bits: uint,
-                                   new_bits: uint,
-                                   filename: *c_char,
-                                   line: size_t) {
+    unsafe fn debug_borrow_slow<T,P:RawPtr<T>>(tag: &'static str,
+                                               p: P,
+                                               old_bits: uint,
+                                               new_bits: uint,
+                                               filename: *c_char,
+                                               line: size_t) {
         let dbg = STDERR_FILENO as io::fd_t;
         dbg.write_str(tag);
-        dbg.write_hex(p as uint);
+        dbg.write_hex(p.to_uint());
         dbg.write_str(" ");
         dbg.write_hex(old_bits);
         dbg.write_str(" ");
diff --git a/src/libstd/rt/comm.rs b/src/libstd/rt/comm.rs
index b547d3c9c30..4b1881409f4 100644
--- a/src/libstd/rt/comm.rs
+++ b/src/libstd/rt/comm.rs
@@ -159,7 +159,7 @@ impl<T> ChanOne<T> {
                         };
                     } else {
                         let recvr = Cell::new(recvr);
-                        do Local::borrow::<Scheduler, ()> |sched| {
+                        do Local::borrow |sched: &mut Scheduler| {
                             sched.enqueue_blocked_task(recvr.take());
                         }
                     }
@@ -199,7 +199,7 @@ impl<T> PortOne<T> {
         if !this.optimistic_check() {
             // No data available yet.
             // Switch to the scheduler to put the ~Task into the Packet state.
-            let sched = Local::take::<Scheduler>();
+            let sched: ~Scheduler = Local::take();
             do sched.deschedule_running_task_and_then |sched, task| {
                 this.block_on(sched, task);
             }
@@ -221,7 +221,7 @@ impl<T> SelectInner for PortOne<T> {
         // The optimistic check is never necessary for correctness. For testing
         // purposes, making it randomly return false simulates a racing sender.
         use rand::{Rand};
-        let actually_check = do Local::borrow::<Scheduler, bool> |sched| {
+        let actually_check = do Local::borrow |sched: &mut Scheduler| {
             Rand::rand(&mut sched.rng)
         };
         if actually_check {
diff --git a/src/libstd/rt/io/file.rs b/src/libstd/rt/io/file.rs
index 65db76d5ef7..f4e9c4d7c11 100644
--- a/src/libstd/rt/io/file.rs
+++ b/src/libstd/rt/io/file.rs
@@ -24,7 +24,7 @@ pub fn open<P: PathLike>(path: &P,
                          access: FileAccess
                         ) -> Option<FileStream> {
     let open_result = unsafe {
-        let io = Local::unsafe_borrow::<IoFactoryObject>();
+        let io: *mut IoFactoryObject = Local::unsafe_borrow();
         (*io).fs_open(path, mode, access)
     };
     match open_result {
@@ -43,7 +43,7 @@ pub fn open<P: PathLike>(path: &P,
 /// by `path`.
 pub fn unlink<P: PathLike>(path: &P) {
     let unlink_result = unsafe {
-        let io = Local::unsafe_borrow::<IoFactoryObject>();
+        let io: *mut IoFactoryObject = Local::unsafe_borrow();
         (*io).fs_unlink(path)
     };
     match unlink_result {
diff --git a/src/libstd/rt/io/net/ip.rs b/src/libstd/rt/io/net/ip.rs
index 3b3ea80eafa..d1d6b16e2eb 100644
--- a/src/libstd/rt/io/net/ip.rs
+++ b/src/libstd/rt/io/net/ip.rs
@@ -359,7 +359,7 @@ impl FromStr for SocketAddr {
 mod test {
     use super::*;
     use from_str::FromStr;
-    use option::{Some, None};
+    use option::{Option, Some, None};
 
     #[test]
     fn test_from_str_ipv4() {
@@ -368,13 +368,17 @@ mod test {
         assert_eq!(Some(Ipv4Addr(0, 0, 0, 0)), FromStr::from_str("0.0.0.0"));
 
         // out of range
-        assert_eq!(None, FromStr::from_str::<IpAddr>("256.0.0.1"));
+        let none: Option<IpAddr> = FromStr::from_str("256.0.0.1");
+        assert_eq!(None, none);
         // too short
-        assert_eq!(None, FromStr::from_str::<IpAddr>("255.0.0"));
+        let none: Option<IpAddr> = FromStr::from_str("255.0.0");
+        assert_eq!(None, none);
         // too long
-        assert_eq!(None, FromStr::from_str::<IpAddr>("255.0.0.1.2"));
+        let none: Option<IpAddr> = FromStr::from_str("255.0.0.1.2");
+        assert_eq!(None, none);
         // no number between dots
-        assert_eq!(None, FromStr::from_str::<IpAddr>("255.0..1"));
+        let none: Option<IpAddr> = FromStr::from_str("255.0..1");
+        assert_eq!(None, none);
     }
 
     #[test]
@@ -389,15 +393,20 @@ mod test {
                 FromStr::from_str("2a02:6b8::11:11"));
 
         // too long group
-        assert_eq!(None, FromStr::from_str::<IpAddr>("::00000"));
+        let none: Option<IpAddr> = FromStr::from_str("::00000");
+        assert_eq!(None, none);
         // too short
-        assert_eq!(None, FromStr::from_str::<IpAddr>("1:2:3:4:5:6:7"));
+        let none: Option<IpAddr> = FromStr::from_str("1:2:3:4:5:6:7");
+        assert_eq!(None, none);
         // too long
-        assert_eq!(None, FromStr::from_str::<IpAddr>("1:2:3:4:5:6:7:8:9"));
+        let none: Option<IpAddr> = FromStr::from_str("1:2:3:4:5:6:7:8:9");
+        assert_eq!(None, none);
         // triple colon
-        assert_eq!(None, FromStr::from_str::<IpAddr>("1:2:::6:7:8"));
+        let none: Option<IpAddr> = FromStr::from_str("1:2:::6:7:8");
+        assert_eq!(None, none);
         // two double colons
-        assert_eq!(None, FromStr::from_str::<IpAddr>("1:2::6::8"));
+        let none: Option<IpAddr> = FromStr::from_str("1:2::6::8");
+        assert_eq!(None, none);
     }
 
     #[test]
@@ -412,11 +421,15 @@ mod test {
                 FromStr::from_str("2001:db8:122:c000:2:2100:192.0.2.33"));
 
         // colon after v4
-        assert_eq!(None, FromStr::from_str::<IpAddr>("::127.0.0.1:"));
+        let none: Option<IpAddr> = FromStr::from_str("::127.0.0.1:");
+        assert_eq!(None, none);
         // not enought groups
-        assert_eq!(None, FromStr::from_str::<IpAddr>("1.2.3.4.5:127.0.0.1"));
+        let none: Option<IpAddr> = FromStr::from_str("1.2.3.4.5:127.0.0.1");
+        assert_eq!(None, none);
         // too many groups
-        assert_eq!(None, FromStr::from_str::<IpAddr>("1.2.3.4.5:6:7:127.0.0.1"));
+        let none: Option<IpAddr> =
+            FromStr::from_str("1.2.3.4.5:6:7:127.0.0.1");
+        assert_eq!(None, none);
     }
 
     #[test]
@@ -429,13 +442,17 @@ mod test {
                 FromStr::from_str("[::127.0.0.1]:22"));
 
         // without port
-        assert_eq!(None, FromStr::from_str::<SocketAddr>("127.0.0.1"));
+        let none: Option<SocketAddr> = FromStr::from_str("127.0.0.1");
+        assert_eq!(None, none);
         // without port
-        assert_eq!(None, FromStr::from_str::<SocketAddr>("127.0.0.1:"));
+        let none: Option<SocketAddr> = FromStr::from_str("127.0.0.1:");
+        assert_eq!(None, none);
         // wrong brackets around v4
-        assert_eq!(None, FromStr::from_str::<SocketAddr>("[127.0.0.1]:22"));
+        let none: Option<SocketAddr> = FromStr::from_str("[127.0.0.1]:22");
+        assert_eq!(None, none);
         // port out of range
-        assert_eq!(None, FromStr::from_str::<SocketAddr>("127.0.0.1:123456"));
+        let none: Option<SocketAddr> = FromStr::from_str("127.0.0.1:123456");
+        assert_eq!(None, none);
     }
 
     #[test]
diff --git a/src/libstd/rt/io/net/tcp.rs b/src/libstd/rt/io/net/tcp.rs
index 746fa5668a5..9be5540de48 100644
--- a/src/libstd/rt/io/net/tcp.rs
+++ b/src/libstd/rt/io/net/tcp.rs
@@ -29,7 +29,7 @@ impl TcpStream {
     pub fn connect(addr: SocketAddr) -> Option<TcpStream> {
         let stream = unsafe {
             rtdebug!("borrowing io to connect");
-            let io = Local::unsafe_borrow::<IoFactoryObject>();
+            let io: *mut IoFactoryObject = Local::unsafe_borrow();
             rtdebug!("about to connect");
             (*io).tcp_connect(addr)
         };
@@ -100,7 +100,7 @@ pub struct TcpListener(~RtioTcpListenerObject);
 impl TcpListener {
     pub fn bind(addr: SocketAddr) -> Option<TcpListener> {
         let listener = unsafe {
-            let io = Local::unsafe_borrow::<IoFactoryObject>();
+            let io: *mut IoFactoryObject = Local::unsafe_borrow();
             (*io).tcp_bind(addr)
         };
         match listener {
diff --git a/src/libstd/rt/io/net/udp.rs b/src/libstd/rt/io/net/udp.rs
index 644abcbe145..132ca064515 100644
--- a/src/libstd/rt/io/net/udp.rs
+++ b/src/libstd/rt/io/net/udp.rs
@@ -20,7 +20,10 @@ pub struct UdpSocket(~RtioUdpSocketObject);
 
 impl UdpSocket {
     pub fn bind(addr: SocketAddr) -> Option<UdpSocket> {
-        let socket = unsafe { (*Local::unsafe_borrow::<IoFactoryObject>()).udp_bind(addr) };
+        let socket = unsafe {
+            let factory: *mut IoFactoryObject = Local::unsafe_borrow();
+            (*factory).udp_bind(addr)
+        };
         match socket {
             Ok(s) => Some(UdpSocket(s)),
             Err(ioerr) => {
diff --git a/src/libstd/rt/io/timer.rs b/src/libstd/rt/io/timer.rs
index b0ec747800d..7f2d88f994d 100644
--- a/src/libstd/rt/io/timer.rs
+++ b/src/libstd/rt/io/timer.rs
@@ -22,7 +22,7 @@ impl Timer {
     pub fn new() -> Option<Timer> {
         let timer = unsafe {
             rtdebug!("Timer::init: borrowing io to init timer");
-            let io = Local::unsafe_borrow::<IoFactoryObject>();
+            let io: *mut IoFactoryObject = Local::unsafe_borrow();
             rtdebug!("about to init timer");
             (*io).timer_init()
         };
diff --git a/src/libstd/rt/local.rs b/src/libstd/rt/local.rs
index 18b7394700f..d4f31879c00 100644
--- a/src/libstd/rt/local.rs
+++ b/src/libstd/rt/local.rs
@@ -19,7 +19,7 @@ use cell::Cell;
 pub trait Local {
     fn put(value: ~Self);
     fn take() -> ~Self;
-    fn exists() -> bool;
+    fn exists(unused_value: Option<Self>) -> bool;
     fn borrow<T>(f: &fn(&mut Self) -> T) -> T;
     unsafe fn unsafe_take() -> ~Self;
     unsafe fn unsafe_borrow() -> *mut Self;
@@ -31,7 +31,7 @@ impl Local for Task {
     fn put(value: ~Task) { unsafe { local_ptr::put(value) } }
     #[inline]
     fn take() -> ~Task { unsafe { local_ptr::take() } }
-    fn exists() -> bool { local_ptr::exists() }
+    fn exists(_: Option<Task>) -> bool { local_ptr::exists() }
     fn borrow<T>(f: &fn(&mut Task) -> T) -> T {
         let mut res: Option<T> = None;
         let res_ptr: *mut Option<T> = &mut res;
@@ -59,7 +59,7 @@ impl Local for Task {
 impl Local for Scheduler {
     fn put(value: ~Scheduler) {
         let value = Cell::new(value);
-        do Local::borrow::<Task,()> |task| {
+        do Local::borrow |task: &mut Task| {
             let task = task;
             task.sched = Some(value.take());
         };
@@ -68,12 +68,12 @@ impl Local for Scheduler {
     fn take() -> ~Scheduler {
         unsafe {
             // XXX: Unsafe for speed
-            let task = Local::unsafe_borrow::<Task>();
+            let task: *mut Task = Local::unsafe_borrow();
             (*task).sched.take_unwrap()
         }
     }
-    fn exists() -> bool {
-        do Local::borrow::<Task,bool> |task| {
+    fn exists(_: Option<Scheduler>) -> bool {
+        do Local::borrow |task: &mut Task| {
             match task.sched {
                 Some(ref _task) => true,
                 None => false
@@ -81,7 +81,7 @@ impl Local for Scheduler {
         }
     }
     fn borrow<T>(f: &fn(&mut Scheduler) -> T) -> T {
-        do Local::borrow::<Task, T> |task| {
+        do Local::borrow |task: &mut Task| {
             match task.sched {
                 Some(~ref mut task) => {
                     f(task)
@@ -94,7 +94,8 @@ impl Local for Scheduler {
     }
     unsafe fn unsafe_take() -> ~Scheduler { rtabort!("unimpl") }
     unsafe fn unsafe_borrow() -> *mut Scheduler {
-        match (*Local::unsafe_borrow::<Task>()).sched {
+        let task: *mut Task = Local::unsafe_borrow();
+        match (*task).sched {
             Some(~ref mut sched) => {
                 let s: *mut Scheduler = &mut *sched;
                 return s;
@@ -105,7 +106,8 @@ impl Local for Scheduler {
         }
     }
     unsafe fn try_unsafe_borrow() -> Option<*mut Scheduler> {
-        match Local::try_unsafe_borrow::<Task>() {
+        let task_opt: Option<*mut Task> = Local::try_unsafe_borrow();
+        match task_opt {
             Some(task) => {
                 match (*task).sched {
                     Some(~ref mut sched) => {
@@ -124,15 +126,17 @@ impl Local for Scheduler {
 impl Local for IoFactoryObject {
     fn put(_value: ~IoFactoryObject) { rtabort!("unimpl") }
     fn take() -> ~IoFactoryObject { rtabort!("unimpl") }
-    fn exists() -> bool { rtabort!("unimpl") }
+    fn exists(_: Option<IoFactoryObject>) -> bool { rtabort!("unimpl") }
     fn borrow<T>(_f: &fn(&mut IoFactoryObject) -> T) -> T { rtabort!("unimpl") }
     unsafe fn unsafe_take() -> ~IoFactoryObject { rtabort!("unimpl") }
     unsafe fn unsafe_borrow() -> *mut IoFactoryObject {
-        let sched = Local::unsafe_borrow::<Scheduler>();
+        let sched: *mut Scheduler = Local::unsafe_borrow();
         let io: *mut IoFactoryObject = (*sched).event_loop.io().unwrap();
         return io;
     }
-    unsafe fn try_unsafe_borrow() -> Option<*mut IoFactoryObject> { rtabort!("unimpl") }
+    unsafe fn try_unsafe_borrow() -> Option<*mut IoFactoryObject> {
+        rtabort!("unimpl")
+    }
 }
 
 
@@ -198,7 +202,7 @@ mod test {
             let task = ~Task::new_root(&mut sched.stack_pool, None, || {});
             Local::put(task);
 
-            let res = do Local::borrow::<Task,bool> |_task| {
+            let res = do Local::borrow |_task: &mut Task| {
                 true
             };
             assert!(res)
diff --git a/src/libstd/rt/local_heap.rs b/src/libstd/rt/local_heap.rs
index aa8c5dd4674..12ec19a1ecc 100644
--- a/src/libstd/rt/local_heap.rs
+++ b/src/libstd/rt/local_heap.rs
@@ -13,7 +13,7 @@
 use libc;
 use libc::{c_void, uintptr_t, size_t};
 use ops::Drop;
-use option::{Some, None};
+use option::{Option, None, Some};
 use rt::local::Local;
 use rt::task::Task;
 use unstable::raw;
@@ -89,7 +89,8 @@ impl Drop for LocalHeap {
 // A little compatibility function
 pub unsafe fn local_free(ptr: *libc::c_char) {
     // XXX: Unsafe borrow for speed. Lame.
-    match Local::try_unsafe_borrow::<Task>() {
+    let task_ptr: Option<*mut Task> = Local::try_unsafe_borrow();
+    match task_ptr {
         Some(task) => {
             (*task).heap.free(ptr as *libc::c_void);
         }
@@ -98,7 +99,7 @@ pub unsafe fn local_free(ptr: *libc::c_char) {
 }
 
 pub fn live_allocs() -> *raw::Box<()> {
-    let region = do Local::borrow::<Task, *BoxedRegion> |task| {
+    let region = do Local::borrow |task: &mut Task| {
         task.heap.boxed_region
     };
 
diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs
index 7436efb5bf5..6dbeb8c0ea9 100644
--- a/src/libstd/rt/mod.rs
+++ b/src/libstd/rt/mod.rs
@@ -64,7 +64,7 @@ use cell::Cell;
 use clone::Clone;
 use container::Container;
 use iterator::{Iterator, range};
-use option::{Some, None};
+use option::{Option, None, Some};
 use ptr::RawPtr;
 use rt::local::Local;
 use rt::sched::{Scheduler, Shutdown};
@@ -408,7 +408,8 @@ fn run_(main: ~fn(), use_main_sched: bool) -> int {
 
 pub fn in_sched_context() -> bool {
     unsafe {
-        match Local::try_unsafe_borrow::<Task>() {
+        let task_ptr: Option<*mut Task> = Local::try_unsafe_borrow();
+        match task_ptr {
             Some(task) => {
                 match (*task).task_type {
                     SchedTask => true,
@@ -422,7 +423,8 @@ pub fn in_sched_context() -> bool {
 
 pub fn in_green_task_context() -> bool {
     unsafe {
-        match Local::try_unsafe_borrow::<Task>() {
+        let task: Option<*mut Task> = Local::try_unsafe_borrow();
+        match task {
             Some(task) => {
                 match (*task).task_type {
                     GreenTask(_) => true,
diff --git a/src/libstd/rt/sched.rs b/src/libstd/rt/sched.rs
index 7d59627ba39..b393832871d 100644
--- a/src/libstd/rt/sched.rs
+++ b/src/libstd/rt/sched.rs
@@ -169,13 +169,13 @@ impl Scheduler {
         // successfully run the input task. Start by running the
         // scheduler. Grab it out of TLS - performing the scheduler
         // action will have given it away.
-        let sched = Local::take::<Scheduler>();
+        let sched: ~Scheduler = Local::take();
 
         rtdebug!("starting scheduler %u", sched.sched_id());
         sched.run();
 
         // Close the idle callback.
-        let mut sched = Local::take::<Scheduler>();
+        let mut sched: ~Scheduler = Local::take();
         sched.idle_callback.get_mut_ref().close();
         // Make one go through the loop to run the close callback.
         sched.run();
@@ -185,7 +185,7 @@ impl Scheduler {
         // cleaning up the memory it uses. As we didn't actually call
         // task.run() on the scheduler task we never get through all
         // the cleanup code it runs.
-        let mut stask = Local::take::<Task>();
+        let mut stask: ~Task = Local::take();
 
         rtdebug!("stopping scheduler %u", stask.sched.get_ref().sched_id());
 
@@ -212,7 +212,7 @@ impl Scheduler {
             // Our scheduler must be in the task before the event loop
             // is started.
             let self_sched = Cell::new(self_sched);
-            do Local::borrow::<Task,()> |stask| {
+            do Local::borrow |stask: &mut Task| {
                 stask.sched = Some(self_sched.take());
             };
 
@@ -234,7 +234,7 @@ impl Scheduler {
         // already have a scheduler stored in our local task, so we
         // start off by taking it. This is the only path through the
         // scheduler where we get the scheduler this way.
-        let mut sched = Local::take::<Scheduler>();
+        let mut sched: ~Scheduler = Local::take();
 
         // Assume that we need to continue idling unless we reach the
         // end of this function without performing an action.
@@ -522,7 +522,7 @@ impl Scheduler {
         // The current task is grabbed from TLS, not taken as an input.
         // Doing an unsafe_take to avoid writing back a null pointer -
         // We're going to call `put` later to do that.
-        let current_task: ~Task = unsafe { Local::unsafe_take::<Task>() };
+        let current_task: ~Task = unsafe { Local::unsafe_take() };
 
         // Check that the task is not in an atomically() section (e.g.,
         // holding a pthread mutex, which could deadlock the scheduler).
@@ -554,7 +554,8 @@ impl Scheduler {
 
             let current_task: &mut Task = match sched.cleanup_job {
                 Some(CleanupJob { task: ref task, _ }) => {
-                    transmute_mut_region(*transmute_mut_unsafe(task))
+                    let task_ptr: *~Task = task;
+                    transmute_mut_region(*transmute_mut_unsafe(task_ptr))
                 }
                 None => {
                     rtabort!("no cleanup job");
@@ -580,7 +581,7 @@ impl Scheduler {
         // run the cleanup job, as expected by the previously called
         // swap_contexts function.
         unsafe {
-            let task = Local::unsafe_borrow::<Task>();
+            let task: *mut Task = Local::unsafe_borrow();
             (*task).sched.get_mut_ref().run_cleanup_job();
 
             // Must happen after running the cleanup job (of course).
@@ -685,13 +686,13 @@ impl Scheduler {
     }
 
     pub fn run_task(task: ~Task) {
-        let sched = Local::take::<Scheduler>();
+        let sched: ~Scheduler = Local::take();
         sched.process_task(task, Scheduler::switch_task).map_move(Local::put);
     }
 
     pub fn run_task_later(next_task: ~Task) {
         let next_task = Cell::new(next_task);
-        do Local::borrow::<Scheduler,()> |sched| {
+        do Local::borrow |sched: &mut Scheduler| {
             sched.enqueue_task(next_task.take());
         };
     }
@@ -1023,12 +1024,12 @@ mod test {
         // exit before emptying the work queue
         do run_in_newsched_task {
             do spawntask {
-                let sched = Local::take::<Scheduler>();
+                let sched: ~Scheduler = Local::take();
                 do sched.deschedule_running_task_and_then |sched, task| {
                     let task = Cell::new(task);
                     do sched.event_loop.callback_ms(10) {
                         rtdebug!("in callback");
-                        let mut sched = Local::take::<Scheduler>();
+                        let mut sched: ~Scheduler = Local::take();
                         sched.enqueue_blocked_task(task.take());
                         Local::put(sched);
                     }
diff --git a/src/libstd/rt/select.rs b/src/libstd/rt/select.rs
index 19a4948af3c..6cde0a1f216 100644
--- a/src/libstd/rt/select.rs
+++ b/src/libstd/rt/select.rs
@@ -26,3 +26,4 @@ pub trait SelectInner {
 pub trait SelectPortInner<T> {
     fn recv_ready(self) -> Option<T>;
 }
+
diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs
index 9c2a6e646d2..b1ab7a6cd5d 100644
--- a/src/libstd/rt/task.rs
+++ b/src/libstd/rt/task.rs
@@ -93,7 +93,7 @@ impl Task {
     pub fn build_homed_child(stack_size: Option<uint>, f: ~fn(), home: SchedHome) -> ~Task {
         let f = Cell::new(f);
         let home = Cell::new(home);
-        do Local::borrow::<Task, ~Task> |running_task| {
+        do Local::borrow |running_task: &mut Task| {
             let mut sched = running_task.sched.take_unwrap();
             let new_task = ~running_task.new_child_homed(&mut sched.stack_pool,
                                                          stack_size,
@@ -111,7 +111,7 @@ impl Task {
     pub fn build_homed_root(stack_size: Option<uint>, f: ~fn(), home: SchedHome) -> ~Task {
         let f = Cell::new(f);
         let home = Cell::new(home);
-        do Local::borrow::<Task, ~Task> |running_task| {
+        do Local::borrow |running_task: &mut Task| {
             let mut sched = running_task.sched.take_unwrap();
             let new_task = ~Task::new_root_homed(&mut sched.stack_pool,
                                                  stack_size,
@@ -305,7 +305,7 @@ impl Task {
     // Grab both the scheduler and the task from TLS and check if the
     // task is executing on an appropriate scheduler.
     pub fn on_appropriate_sched() -> bool {
-        do Local::borrow::<Task,bool> |task| {
+        do Local::borrow |task: &mut Task| {
             let sched_id = task.sched.get_ref().sched_id();
             let sched_run_anything = task.sched.get_ref().run_anything;
             match task.task_type {
@@ -369,7 +369,7 @@ impl Coroutine {
             unsafe {
 
                 // Again - might work while safe, or it might not.
-                do Local::borrow::<Scheduler,()> |sched| {
+                do Local::borrow |sched: &mut Scheduler| {
                     sched.run_cleanup_job();
                 }
 
@@ -378,7 +378,7 @@ impl Coroutine {
                 // simply unsafe_borrow it to get this reference. We
                 // need to still have the task in TLS though, so we
                 // need to unsafe_borrow.
-                let task = Local::unsafe_borrow::<Task>();
+                let task: *mut Task = Local::unsafe_borrow();
 
                 do (*task).run {
                     // N.B. Removing `start` from the start wrapper
@@ -397,7 +397,7 @@ impl Coroutine {
             }
 
             // We remove the sched from the Task in TLS right now.
-            let sched = Local::take::<Scheduler>();
+            let sched: ~Scheduler = Local::take();
             // ... allowing us to give it away when performing a
             // scheduling operation.
             sched.terminate_current_task()
diff --git a/src/libstd/rt/tube.rs b/src/libstd/rt/tube.rs
index 247893f75de..b8e535e4c7d 100644
--- a/src/libstd/rt/tube.rs
+++ b/src/libstd/rt/tube.rs
@@ -51,7 +51,7 @@ impl<T> Tube<T> {
                 // There's a waiting task. Wake it up
                 rtdebug!("waking blocked tube");
                 let task = (*state).blocked_task.take_unwrap();
-                let sched = Local::take::<Scheduler>();
+                let sched: ~Scheduler = Local::take();
                 sched.resume_blocked_task_immediately(task);
             }
         }
@@ -67,7 +67,7 @@ impl<T> Tube<T> {
                 rtdebug!("blocking on tube recv");
                 assert!(self.p.refcount() > 1); // There better be somebody to wake us up
                 assert!((*state).blocked_task.is_none());
-                let sched = Local::take::<Scheduler>();
+                let sched: ~Scheduler = Local::take();
                 do sched.deschedule_running_task_and_then |_, task| {
                     (*state).blocked_task = Some(task);
                 }
@@ -102,7 +102,7 @@ mod test {
             let mut tube: Tube<int> = Tube::new();
             let tube_clone = tube.clone();
             let tube_clone_cell = Cell::new(tube_clone);
-            let sched = Local::take::<Scheduler>();
+            let sched: ~Scheduler = Local::take();
             do sched.deschedule_running_task_and_then |sched, task| {
                 let mut tube_clone = tube_clone_cell.take();
                 tube_clone.send(1);
@@ -119,7 +119,7 @@ mod test {
             let mut tube: Tube<int> = Tube::new();
             let tube_clone = tube.clone();
             let tube_clone = Cell::new(tube_clone);
-            let sched = Local::take::<Scheduler>();
+            let sched: ~Scheduler = Local::take();
             do sched.deschedule_running_task_and_then |sched, task| {
                 let tube_clone = Cell::new(tube_clone.take());
                 do sched.event_loop.callback {
@@ -143,7 +143,7 @@ mod test {
             let mut tube: Tube<int> = Tube::new();
             let tube_clone = tube.clone();
             let tube_clone = Cell::new(tube_clone);
-            let sched = Local::take::<Scheduler>();
+            let sched: ~Scheduler = Local::take();
             do sched.deschedule_running_task_and_then |sched, task| {
                 callback_send(tube_clone.take(), 0);
 
@@ -151,7 +151,7 @@ mod test {
                     if i == 100 { return; }
 
                     let tube = Cell::new(Cell::new(tube));
-                    do Local::borrow::<Scheduler, ()> |sched| {
+                    do Local::borrow |sched: &mut Scheduler| {
                         let tube = tube.take();
                         do sched.event_loop.callback {
                             let mut tube = tube.take();
diff --git a/src/libstd/rt/uv/uvio.rs b/src/libstd/rt/uv/uvio.rs
index 6e79a78e061..e620ab274b1 100644
--- a/src/libstd/rt/uv/uvio.rs
+++ b/src/libstd/rt/uv/uvio.rs
@@ -57,7 +57,7 @@ trait HomingIO {
         let old_home = Cell::new_empty();
         let old_home_ptr = &old_home;
         do task::unkillable { // FIXME(#8674)
-            let scheduler = Local::take::<Scheduler>();
+            let scheduler: ~Scheduler = Local::take();
             do scheduler.deschedule_running_task_and_then |_, task| {
                 // get the old home first
                 do task.wake().map_move |mut task| {
@@ -72,7 +72,7 @@ trait HomingIO {
 
         // unhome home
         do task::unkillable { // FIXME(#8674)
-            let scheduler = Local::take::<Scheduler>();
+            let scheduler: ~Scheduler = Local::take();
             do scheduler.deschedule_running_task_and_then |scheduler, task| {
                 do task.wake().map_move |mut task| {
                     task.give_home(old_home.take());
@@ -92,7 +92,7 @@ trait HomingIO {
             // go home
             let old_home = Cell::new_empty();
             let old_home_ptr = &old_home;
-            let scheduler = Local::take::<Scheduler>();
+            let scheduler: ~Scheduler = Local::take();
             do scheduler.deschedule_running_task_and_then |_, task| {
                 // get the old home first
                 do task.wake().map_move |mut task| {
@@ -102,11 +102,11 @@ trait HomingIO {
             }
 
             // do IO
-            let scheduler = Local::take::<Scheduler>();
+            let scheduler: ~Scheduler = Local::take();
             let a = io_sched(self, scheduler);
 
             // unhome home
-            let scheduler = Local::take::<Scheduler>();
+            let scheduler: ~Scheduler = Local::take();
             do scheduler.deschedule_running_task_and_then |scheduler, task| {
                 do task.wake().map_move |mut task| {
                     task.give_home(old_home.take());
@@ -122,7 +122,7 @@ trait HomingIO {
 
 // get a handle for the current scheduler
 macro_rules! get_handle_to_current_scheduler(
-    () => (do Local::borrow::<Scheduler, SchedHandle> |sched| { sched.make_handle() })
+    () => (do Local::borrow |sched: &mut Scheduler| { sched.make_handle() })
 )
 
 enum SocketNameKind {
@@ -375,7 +375,7 @@ mod test_remote {
             let mut tube = Tube::new();
             let tube_clone = tube.clone();
             let remote_cell = Cell::new_empty();
-            do Local::borrow::<Scheduler, ()>() |sched| {
+            do Local::borrow |sched: &mut Scheduler| {
                 let tube_clone = tube_clone.clone();
                 let tube_clone_cell = Cell::new(tube_clone);
                 let remote = do sched.event_loop.remote_callback {
@@ -416,7 +416,7 @@ impl IoFactory for UvIoFactory {
 
         // Block this task and take ownership, switch to scheduler context
         do task::unkillable { // FIXME(#8674)
-            let scheduler = Local::take::<Scheduler>();
+            let scheduler: ~Scheduler = Local::take();
             do scheduler.deschedule_running_task_and_then |_, task| {
 
                 let mut tcp = TcpWatcher::new(self.uv_loop());
@@ -434,7 +434,7 @@ impl IoFactory for UvIoFactory {
                             unsafe { (*result_cell_ptr).put_back(res); }
 
                             // Context switch
-                            let scheduler = Local::take::<Scheduler>();
+                            let scheduler: ~Scheduler = Local::take();
                             scheduler.resume_blocked_task_immediately(task_cell.take());
                         }
                         Some(_) => {
@@ -442,7 +442,7 @@ impl IoFactory for UvIoFactory {
                             do stream.close {
                                 let res = Err(uv_error_to_io_error(status.unwrap()));
                                 unsafe { (*result_cell_ptr).put_back(res); }
-                                let scheduler = Local::take::<Scheduler>();
+                                let scheduler: ~Scheduler = Local::take();
                                 scheduler.resume_blocked_task_immediately(task_cell.take());
                             }
                         }
@@ -464,11 +464,11 @@ impl IoFactory for UvIoFactory {
             }
             Err(uverr) => {
                 do task::unkillable { // FIXME(#8674)
-                    let scheduler = Local::take::<Scheduler>();
+                    let scheduler: ~Scheduler = Local::take();
                     do scheduler.deschedule_running_task_and_then |_, task| {
                         let task_cell = Cell::new(task);
                         do watcher.as_stream().close {
-                            let scheduler = Local::take::<Scheduler>();
+                            let scheduler: ~Scheduler = Local::take();
                             scheduler.resume_blocked_task_immediately(task_cell.take());
                         }
                     }
@@ -487,11 +487,11 @@ impl IoFactory for UvIoFactory {
             }
             Err(uverr) => {
                 do task::unkillable { // FIXME(#8674)
-                    let scheduler = Local::take::<Scheduler>();
+                    let scheduler: ~Scheduler = Local::take();
                     do scheduler.deschedule_running_task_and_then |_, task| {
                         let task_cell = Cell::new(task);
                         do watcher.close {
-                            let scheduler = Local::take::<Scheduler>();
+                            let scheduler: ~Scheduler = Local::take();
                             scheduler.resume_blocked_task_immediately(task_cell.take());
                         }
                     }
@@ -539,7 +539,7 @@ impl IoFactory for UvIoFactory {
                                            IoError>> = &result_cell;
         let path_cell = Cell::new(path);
         do task::unkillable { // FIXME(#8674)
-            let scheduler = Local::take::<Scheduler>();
+            let scheduler: ~Scheduler = Local::take();
             do scheduler.deschedule_running_task_and_then |_, task| {
                 let task_cell = Cell::new(task);
                 let path = path_cell.take();
@@ -553,12 +553,12 @@ impl IoFactory for UvIoFactory {
                             loop_, fd, true, home) as ~RtioFileStream;
                         let res = Ok(fs);
                         unsafe { (*result_cell_ptr).put_back(res); }
-                        let scheduler = Local::take::<Scheduler>();
+                        let scheduler: ~Scheduler = Local::take();
                         scheduler.resume_blocked_task_immediately(task_cell.take());
                     } else {
                         let res = Err(uv_error_to_io_error(err.unwrap()));
                         unsafe { (*result_cell_ptr).put_back(res); }
-                        let scheduler = Local::take::<Scheduler>();
+                        let scheduler: ~Scheduler = Local::take();
                         scheduler.resume_blocked_task_immediately(task_cell.take());
                     }
                 };
@@ -573,7 +573,7 @@ impl IoFactory for UvIoFactory {
         let result_cell_ptr: *Cell<Result<(), IoError>> = &result_cell;
         let path_cell = Cell::new(path);
         do task::unkillable { // FIXME(#8674)
-            let scheduler = Local::take::<Scheduler>();
+            let scheduler: ~Scheduler = Local::take();
             do scheduler.deschedule_running_task_and_then |_, task| {
                 let task_cell = Cell::new(task);
                 let path = path_cell.take();
@@ -583,7 +583,7 @@ impl IoFactory for UvIoFactory {
                         Some(err) => Err(uv_error_to_io_error(err))
                     };
                     unsafe { (*result_cell_ptr).put_back(res); }
-                    let scheduler = Local::take::<Scheduler>();
+                    let scheduler: ~Scheduler = Local::take();
                     scheduler.resume_blocked_task_immediately(task_cell.take());
                 };
             };
@@ -625,7 +625,7 @@ impl Drop for UvTcpListener {
             do scheduler.deschedule_running_task_and_then |_, task| {
                 let task_cell = Cell::new(task);
                 do self_.watcher().as_stream().close {
-                    let scheduler = Local::take::<Scheduler>();
+                    let scheduler: ~Scheduler = Local::take();
                     scheduler.resume_blocked_task_immediately(task_cell.take());
                 }
             }
@@ -717,7 +717,7 @@ impl Drop for UvTcpStream {
             do scheduler.deschedule_running_task_and_then |_, task| {
                 let task_cell = Cell::new(task);
                 do self_.watcher.as_stream().close {
-                    let scheduler = Local::take::<Scheduler>();
+                    let scheduler: ~Scheduler = Local::take();
                     scheduler.resume_blocked_task_immediately(task_cell.take());
                 }
             }
@@ -765,7 +765,7 @@ impl RtioTcpStream for UvTcpStream {
 
                     unsafe { (*result_cell_ptr).put_back(result); }
 
-                    let scheduler = Local::take::<Scheduler>();
+                    let scheduler: ~Scheduler = Local::take();
                     scheduler.resume_blocked_task_immediately(task_cell.take());
                 }
             }
@@ -793,7 +793,7 @@ impl RtioTcpStream for UvTcpStream {
 
                     unsafe { (*result_cell_ptr).put_back(result); }
 
-                    let scheduler = Local::take::<Scheduler>();
+                    let scheduler: ~Scheduler = Local::take();
                     scheduler.resume_blocked_task_immediately(task_cell.take());
                 }
             }
@@ -876,7 +876,7 @@ impl Drop for UvUdpSocket {
             do scheduler.deschedule_running_task_and_then |_, task| {
                 let task_cell = Cell::new(task);
                 do self_.watcher.close {
-                    let scheduler = Local::take::<Scheduler>();
+                    let scheduler: ~Scheduler = Local::take();
                     scheduler.resume_blocked_task_immediately(task_cell.take());
                 }
             }
@@ -917,7 +917,7 @@ impl RtioUdpSocket for UvUdpSocket {
 
                     unsafe { (*result_cell_ptr).put_back(result); }
 
-                    let scheduler = Local::take::<Scheduler>();
+                    let scheduler: ~Scheduler = Local::take();
                     scheduler.resume_blocked_task_immediately(task_cell.take());
                 }
             }
@@ -944,7 +944,7 @@ impl RtioUdpSocket for UvUdpSocket {
 
                     unsafe { (*result_cell_ptr).put_back(result); }
 
-                    let scheduler = Local::take::<Scheduler>();
+                    let scheduler: ~Scheduler = Local::take();
                     scheduler.resume_blocked_task_immediately(task_cell.take());
                 }
             }
@@ -1094,7 +1094,7 @@ impl Drop for UvTimer {
             do scheduler.deschedule_running_task_and_then |_, task| {
                 let task_cell = Cell::new(task);
                 do self_.watcher.close {
-                    let scheduler = Local::take::<Scheduler>();
+                    let scheduler: ~Scheduler = Local::take();
                     scheduler.resume_blocked_task_immediately(task_cell.take());
                 }
             }
@@ -1110,7 +1110,7 @@ impl RtioTimer for UvTimer {
                 let task_cell = Cell::new(task);
                 do self_.watcher.start(msecs, 0) |_, status| {
                     assert!(status.is_none());
-                    let scheduler = Local::take::<Scheduler>();
+                    let scheduler: ~Scheduler = Local::take();
                     scheduler.resume_blocked_task_immediately(task_cell.take());
                 }
             }
@@ -1154,7 +1154,7 @@ impl UvFileStream {
                         Some(err) => Err(uv_error_to_io_error(err))
                     };
                     unsafe { (*result_cell_ptr).put_back(res); }
-                    let scheduler = Local::take::<Scheduler>();
+                    let scheduler: ~Scheduler = Local::take();
                     scheduler.resume_blocked_task_immediately(task_cell.take());
                 };
             };
@@ -1175,7 +1175,7 @@ impl UvFileStream {
                         Some(err) => Err(uv_error_to_io_error(err))
                     };
                     unsafe { (*result_cell_ptr).put_back(res); }
-                    let scheduler = Local::take::<Scheduler>();
+                    let scheduler: ~Scheduler = Local::take();
                     scheduler.resume_blocked_task_immediately(task_cell.take());
                 };
             };
@@ -1208,7 +1208,7 @@ impl Drop for UvFileStream {
                 do scheduler.deschedule_running_task_and_then |_, task| {
                     let task_cell = Cell::new(task);
                     do self_.fd.close(&self.loop_) |_,_| {
-                        let scheduler = Local::take::<Scheduler>();
+                        let scheduler: ~Scheduler = Local::take();
                         scheduler.resume_blocked_task_immediately(task_cell.take());
                     };
                 };
@@ -1254,7 +1254,7 @@ impl RtioFileStream for UvFileStream {
 fn test_simple_io_no_connect() {
     do run_in_newsched_task {
         unsafe {
-            let io = Local::unsafe_borrow::<IoFactoryObject>();
+            let io: *mut IoFactoryObject = Local::unsafe_borrow();
             let addr = next_test_ip4();
             let maybe_chan = (*io).tcp_connect(addr);
             assert!(maybe_chan.is_err());
@@ -1266,7 +1266,7 @@ fn test_simple_io_no_connect() {
 fn test_simple_udp_io_bind_only() {
     do run_in_newsched_task {
         unsafe {
-            let io = Local::unsafe_borrow::<IoFactoryObject>();
+            let io: *mut IoFactoryObject = Local::unsafe_borrow();
             let addr = next_test_ip4();
             let maybe_socket = (*io).udp_bind(addr);
             assert!(maybe_socket.is_ok());
@@ -1303,7 +1303,9 @@ fn test_simple_homed_udp_io_bind_then_move_task_then_home_and_close() {
         };
 
         let test_function: ~fn() = || {
-            let io = unsafe { Local::unsafe_borrow::<IoFactoryObject>() };
+            let io: *mut IoFactoryObject = unsafe {
+                Local::unsafe_borrow()
+            };
             let addr = next_test_ip4();
             let maybe_socket = unsafe { (*io).udp_bind(addr) };
             // this socket is bound to this event loop
@@ -1311,7 +1313,7 @@ fn test_simple_homed_udp_io_bind_then_move_task_then_home_and_close() {
 
             // block self on sched1
             do task::unkillable { // FIXME(#8674)
-                let scheduler = Local::take::<Scheduler>();
+                let scheduler: ~Scheduler = Local::take();
                 do scheduler.deschedule_running_task_and_then |_, task| {
                     // unblock task
                     do task.wake().map_move |task| {
@@ -1377,7 +1379,9 @@ fn test_simple_homed_udp_io_bind_then_move_handle_then_home_and_close() {
         let chan = Cell::new(chan);
 
         let body1: ~fn() = || {
-            let io = unsafe { Local::unsafe_borrow::<IoFactoryObject>() };
+            let io: *mut IoFactoryObject = unsafe {
+                Local::unsafe_borrow()
+            };
             let addr = next_test_ip4();
             let socket = unsafe { (*io).udp_bind(addr) };
             assert!(socket.is_ok());
@@ -1430,7 +1434,7 @@ fn test_simple_tcp_server_and_client() {
         // Start the server first so it's listening when we connect
         do spawntask {
             unsafe {
-                let io = Local::unsafe_borrow::<IoFactoryObject>();
+                let io: *mut IoFactoryObject = Local::unsafe_borrow();
                 let mut listener = (*io).tcp_bind(addr).unwrap();
                 let mut stream = listener.accept().unwrap();
                 let mut buf = [0, .. 2048];
@@ -1445,7 +1449,7 @@ fn test_simple_tcp_server_and_client() {
 
         do spawntask {
             unsafe {
-                let io = Local::unsafe_borrow::<IoFactoryObject>();
+                let io: *mut IoFactoryObject = Local::unsafe_borrow();
                 let mut stream = (*io).tcp_connect(addr).unwrap();
                 stream.write([0, 1, 2, 3, 4, 5, 6, 7]);
             }
@@ -1489,7 +1493,9 @@ fn test_simple_tcp_server_and_client_on_diff_threads() {
         };
 
         let server_fn: ~fn() = || {
-            let io = unsafe { Local::unsafe_borrow::<IoFactoryObject>() };
+            let io: *mut IoFactoryObject = unsafe {
+                Local::unsafe_borrow()
+            };
             let mut listener = unsafe { (*io).tcp_bind(server_addr).unwrap() };
             let mut stream = listener.accept().unwrap();
             let mut buf = [0, .. 2048];
@@ -1501,7 +1507,9 @@ fn test_simple_tcp_server_and_client_on_diff_threads() {
         };
 
         let client_fn: ~fn() = || {
-            let io = unsafe { Local::unsafe_borrow::<IoFactoryObject>() };
+            let io: *mut IoFactoryObject = unsafe {
+                Local::unsafe_borrow()
+            };
             let mut stream = unsafe { (*io).tcp_connect(client_addr) };
             while stream.is_err() {
                 stream = unsafe { (*io).tcp_connect(client_addr) };
@@ -1540,7 +1548,7 @@ fn test_simple_udp_server_and_client() {
 
         do spawntask {
             unsafe {
-                let io = Local::unsafe_borrow::<IoFactoryObject>();
+                let io: *mut IoFactoryObject = Local::unsafe_borrow();
                 let mut server_socket = (*io).udp_bind(server_addr).unwrap();
                 let mut buf = [0, .. 2048];
                 let (nread,src) = server_socket.recvfrom(buf).unwrap();
@@ -1555,7 +1563,7 @@ fn test_simple_udp_server_and_client() {
 
         do spawntask {
             unsafe {
-                let io = Local::unsafe_borrow::<IoFactoryObject>();
+                let io: *mut IoFactoryObject = Local::unsafe_borrow();
                 let mut client_socket = (*io).udp_bind(client_addr).unwrap();
                 client_socket.sendto([0, 1, 2, 3, 4, 5, 6, 7], server_addr);
             }
@@ -1569,7 +1577,7 @@ fn test_read_and_block() {
         let addr = next_test_ip4();
 
         do spawntask {
-            let io = unsafe { Local::unsafe_borrow::<IoFactoryObject>() };
+            let io: *mut IoFactoryObject = unsafe { Local::unsafe_borrow() };
             let mut listener = unsafe { (*io).tcp_bind(addr).unwrap() };
             let mut stream = listener.accept().unwrap();
             let mut buf = [0, .. 2048];
@@ -1588,7 +1596,7 @@ fn test_read_and_block() {
                 reads += 1;
 
                 do task::unkillable { // FIXME(#8674)
-                    let scheduler = Local::take::<Scheduler>();
+                    let scheduler: ~Scheduler = Local::take();
                     // Yield to the other task in hopes that it
                     // will trigger a read callback while we are
                     // not ready for it
@@ -1605,7 +1613,7 @@ fn test_read_and_block() {
 
         do spawntask {
             unsafe {
-                let io = Local::unsafe_borrow::<IoFactoryObject>();
+                let io: *mut IoFactoryObject = Local::unsafe_borrow();
                 let mut stream = (*io).tcp_connect(addr).unwrap();
                 stream.write([0, 1, 2, 3, 4, 5, 6, 7]);
                 stream.write([0, 1, 2, 3, 4, 5, 6, 7]);
@@ -1625,7 +1633,7 @@ fn test_read_read_read() {
 
         do spawntask {
             unsafe {
-                let io = Local::unsafe_borrow::<IoFactoryObject>();
+                let io: *mut IoFactoryObject = Local::unsafe_borrow();
                 let mut listener = (*io).tcp_bind(addr).unwrap();
                 let mut stream = listener.accept().unwrap();
                 let buf = [1, .. 2048];
@@ -1639,7 +1647,7 @@ fn test_read_read_read() {
 
         do spawntask {
             unsafe {
-                let io = Local::unsafe_borrow::<IoFactoryObject>();
+                let io: *mut IoFactoryObject = Local::unsafe_borrow();
                 let mut stream = (*io).tcp_connect(addr).unwrap();
                 let mut buf = [0, .. 2048];
                 let mut total_bytes_read = 0;
@@ -1665,7 +1673,7 @@ fn test_udp_twice() {
 
         do spawntask {
             unsafe {
-                let io = Local::unsafe_borrow::<IoFactoryObject>();
+                let io: *mut IoFactoryObject = Local::unsafe_borrow();
                 let mut client = (*io).udp_bind(client_addr).unwrap();
                 assert!(client.sendto([1], server_addr).is_ok());
                 assert!(client.sendto([2], server_addr).is_ok());
@@ -1674,7 +1682,7 @@ fn test_udp_twice() {
 
         do spawntask {
             unsafe {
-                let io = Local::unsafe_borrow::<IoFactoryObject>();
+                let io: *mut IoFactoryObject = Local::unsafe_borrow();
                 let mut server = (*io).udp_bind(server_addr).unwrap();
                 let mut buf1 = [0];
                 let mut buf2 = [0];
@@ -1702,7 +1710,7 @@ fn test_udp_many_read() {
 
         do spawntask {
             unsafe {
-                let io = Local::unsafe_borrow::<IoFactoryObject>();
+                let io: *mut IoFactoryObject = Local::unsafe_borrow();
                 let mut server_out = (*io).udp_bind(server_out_addr).unwrap();
                 let mut server_in = (*io).udp_bind(server_in_addr).unwrap();
                 let msg = [1, .. 2048];
@@ -1725,7 +1733,7 @@ fn test_udp_many_read() {
 
         do spawntask {
             unsafe {
-                let io = Local::unsafe_borrow::<IoFactoryObject>();
+                let io: *mut IoFactoryObject = Local::unsafe_borrow();
                 let mut client_out = (*io).udp_bind(client_out_addr).unwrap();
                 let mut client_in = (*io).udp_bind(client_in_addr).unwrap();
                 let mut total_bytes_recv = 0;
@@ -1754,7 +1762,7 @@ fn test_udp_many_read() {
 fn test_timer_sleep_simple() {
     do run_in_newsched_task {
         unsafe {
-            let io = Local::unsafe_borrow::<IoFactoryObject>();
+            let io: *mut IoFactoryObject = Local::unsafe_borrow();
             let timer = (*io).timer_init();
             do timer.map_move |mut t| { t.sleep(1) };
         }
@@ -1768,7 +1776,7 @@ fn file_test_uvio_full_simple_impl() {
     use path::Path;
     use rt::io::{Open, Create, ReadWrite, Read};
     unsafe {
-        let io = Local::unsafe_borrow::<IoFactoryObject>();
+        let io: *mut IoFactoryObject = Local::unsafe_borrow();
         let write_val = "hello uvio!";
         let path = "./tmp/file_test_uvio_full.txt";
         {
@@ -1802,7 +1810,7 @@ fn uvio_naive_print(input: &str) {
     use str::StrSlice;
     unsafe {
         use libc::{STDOUT_FILENO};
-        let io = Local::unsafe_borrow::<IoFactoryObject>();
+        let io: *mut IoFactoryObject = Local::unsafe_borrow();
         {
             let mut fd = (*io).fs_from_raw_fd(STDOUT_FILENO, false);
             let write_buf = input.as_bytes();
diff --git a/src/libstd/select.rs b/src/libstd/select.rs
index 531d55f6043..f121158d4c5 100644
--- a/src/libstd/select.rs
+++ b/src/libstd/select.rs
@@ -60,7 +60,7 @@ pub fn select<A: Select>(ports: &mut [A]) -> uint {
 
     do (|| {
         let c = Cell::new(c.take());
-        let sched = Local::take::<Scheduler>();
+        let sched: ~Scheduler = Local::take();
         do sched.deschedule_running_task_and_then |sched, task| {
             let task_handles = task.make_selectable(ports.len());
 
diff --git a/src/libstd/sys.rs b/src/libstd/sys.rs
index bfb9bee7802..cb0753fb2e5 100644
--- a/src/libstd/sys.rs
+++ b/src/libstd/sys.rs
@@ -143,7 +143,7 @@ pub fn begin_unwind_(msg: *c_char, file: *c_char, line: size_t) -> ! {
         if in_green_task_context() {
             // XXX: Logging doesn't work here - the check to call the log
             // function never passes - so calling the log function directly.
-            do Local::borrow::<Task, ()> |task| {
+            do Local::borrow |task: &mut Task| {
                 let msg = match task.name {
                     Some(ref name) =>
                     fmt!("task '%s' failed at '%s', %s:%i",
@@ -160,7 +160,7 @@ pub fn begin_unwind_(msg: *c_char, file: *c_char, line: size_t) -> ! {
                      msg, file, line as int);
         }
 
-        let task = Local::unsafe_borrow::<Task>();
+        let task: *mut Task = Local::unsafe_borrow();
         if (*task).unwinder.unwinding {
             rtabort!("unwinding again");
         }
diff --git a/src/libstd/task/local_data_priv.rs b/src/libstd/task/local_data_priv.rs
index 8132bfe5377..2c2dfd8f689 100644
--- a/src/libstd/task/local_data_priv.rs
+++ b/src/libstd/task/local_data_priv.rs
@@ -28,7 +28,7 @@ impl Handle {
     pub fn new() -> Handle {
         use rt::local::Local;
         unsafe {
-            let task = Local::unsafe_borrow::<Task>();
+            let task: *mut Task = Local::unsafe_borrow();
             NewHandle(&mut (*task).storage)
         }
     }
diff --git a/src/libstd/task/mod.rs b/src/libstd/task/mod.rs
index f872c2614b9..c0b331c52ee 100644
--- a/src/libstd/task/mod.rs
+++ b/src/libstd/task/mod.rs
@@ -526,7 +526,7 @@ pub fn with_task_name<U>(blk: &fn(Option<&str>) -> U) -> U {
     use rt::task::Task;
 
     if in_green_task_context() {
-        do Local::borrow::<Task, U> |task| {
+        do Local::borrow |task: &mut Task| {
             match task.name {
                 Some(ref name) => blk(Some(name.as_slice())),
                 None => blk(None)
@@ -545,7 +545,7 @@ pub fn deschedule() {
 
     // FIXME #6842: What does yield really mean in newsched?
     // FIXME(#7544): Optimize this, since we know we won't block.
-    let sched = Local::take::<Scheduler>();
+    let sched: ~Scheduler = Local::take();
     do sched.deschedule_running_task_and_then |sched, task| {
         sched.enqueue_blocked_task(task);
     }
@@ -556,7 +556,7 @@ pub fn failing() -> bool {
 
     use rt::task::Task;
 
-    do Local::borrow::<Task, bool> |local| {
+    do Local::borrow |local: &mut Task| {
         local.unwinder.unwinding
     }
 }
@@ -582,7 +582,7 @@ pub fn unkillable<U>(f: &fn() -> U) -> U {
     unsafe {
         if in_green_task_context() {
             // The inhibits/allows might fail and need to borrow the task.
-            let t = Local::unsafe_borrow::<Task>();
+            let t: *mut Task = Local::unsafe_borrow();
             do (|| {
                 (*t).death.inhibit_kill((*t).unwinder.unwinding);
                 f()
@@ -616,7 +616,7 @@ pub fn rekillable<U>(f: &fn() -> U) -> U {
 
     unsafe {
         if in_green_task_context() {
-            let t = Local::unsafe_borrow::<Task>();
+            let t: *mut Task = Local::unsafe_borrow();
             do (|| {
                 (*t).death.allow_kill((*t).unwinder.unwinding);
                 f()
@@ -1032,7 +1032,7 @@ fn test_try_fail() {
 
 #[cfg(test)]
 fn get_sched_id() -> int {
-    do Local::borrow::<::rt::sched::Scheduler, int> |sched| {
+    do Local::borrow |sched: &mut ::rt::sched::Scheduler| {
         sched.sched_id() as int
     }
 }
diff --git a/src/libstd/task/spawn.rs b/src/libstd/task/spawn.rs
index 980141d29c3..c3a3dc56ce2 100644
--- a/src/libstd/task/spawn.rs
+++ b/src/libstd/task/spawn.rs
@@ -449,7 +449,7 @@ impl RuntimeGlue {
     fn kill_task(mut handle: KillHandle) {
         do handle.kill().map_move |killed_task| {
             let killed_task = Cell::new(killed_task);
-            do Local::borrow::<Scheduler, ()> |sched| {
+            do Local::borrow |sched: &mut Scheduler| {
                 sched.enqueue_task(killed_task.take());
             }
         };
@@ -460,7 +460,7 @@ impl RuntimeGlue {
         unsafe {
             // Can't use safe borrow, because the taskgroup destructor needs to
             // access the scheduler again to send kill signals to other tasks.
-            let me = Local::unsafe_borrow::<Task>();
+            let me: *mut Task = Local::unsafe_borrow();
             blk((*me).death.kill_handle.get_ref(), (*me).unwinder.unwinding)
         }
     }
@@ -470,7 +470,7 @@ impl RuntimeGlue {
         unsafe {
             // Can't use safe borrow, because creating new hashmaps for the
             // tasksets requires an rng, which needs to borrow the sched.
-            let me = Local::unsafe_borrow::<Task>();
+            let me: *mut Task = Local::unsafe_borrow();
             blk(match (*me).taskgroup {
                 None => {
                     // First task in its (unlinked/unsupervised) taskgroup.
@@ -574,7 +574,7 @@ pub fn spawn_raw(mut opts: TaskOpts, f: ~fn()) {
         // If child data is 'None', the enlist is vacuously successful.
         let enlist_success = do child_data.take().map_move_default(true) |child_data| {
             let child_data = Cell::new(child_data); // :(
-            do Local::borrow::<Task, bool> |me| {
+            do Local::borrow |me: &mut Task| {
                 let (child_tg, ancestors) = child_data.take();
                 let mut ancestors = ancestors;
                 let handle = me.death.kill_handle.get_ref();
@@ -608,7 +608,7 @@ pub fn spawn_raw(mut opts: TaskOpts, f: ~fn()) {
     } else {
         unsafe {
             // Creating a 1:1 task:thread ...
-            let sched = Local::unsafe_borrow::<Scheduler>();
+            let sched: *mut Scheduler = Local::unsafe_borrow();
             let sched_handle = (*sched).make_handle();
 
             // Since this is a 1:1 scheduler we create a queue not in
diff --git a/src/libstd/to_bytes.rs b/src/libstd/to_bytes.rs
index 198c09964bb..01f57c231da 100644
--- a/src/libstd/to_bytes.rs
+++ b/src/libstd/to_bytes.rs
@@ -343,7 +343,14 @@ impl<A:IterBytes> IterBytes for ~A {
 
 // NB: raw-pointer IterBytes does _not_ dereference
 // to the target; it just gives you the pointer-bytes.
-impl<A> IterBytes for *const A {
+impl<A> IterBytes for *A {
+    #[inline]
+    fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool {
+        (*self as uint).iter_bytes(lsb0, f)
+    }
+}
+
+impl<A> IterBytes for *mut A {
     #[inline]
     fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool {
         (*self as uint).iter_bytes(lsb0, f)
diff --git a/src/libstd/tuple.rs b/src/libstd/tuple.rs
index 12073a1f4f0..5d9ca6202e2 100644
--- a/src/libstd/tuple.rs
+++ b/src/libstd/tuple.rs
@@ -176,7 +176,7 @@ macro_rules! tuple_impls {
                 impl<$($T:Zero),+> Zero for ($($T,)+) {
                     #[inline]
                     fn zero() -> ($($T,)+) {
-                        ($(Zero::zero::<$T>(),)+)
+                        ($({ let x: $T = Zero::zero(); x},)+)
                     }
                     #[inline]
                     fn is_zero(&self) -> bool {
diff --git a/src/libstd/unstable/atomics.rs b/src/libstd/unstable/atomics.rs
index f286235ca0e..f9380e7ad12 100644
--- a/src/libstd/unstable/atomics.rs
+++ b/src/libstd/unstable/atomics.rs
@@ -538,7 +538,8 @@ mod test {
 
     #[test]
     fn option_empty() {
-        assert!(AtomicOption::empty::<()>().is_empty(SeqCst));
+        let mut option: AtomicOption<()> = AtomicOption::empty();
+        assert!(option.is_empty(SeqCst));
     }
 
     #[test]
diff --git a/src/libstd/unstable/lang.rs b/src/libstd/unstable/lang.rs
index e47a3c49f96..1d839b55195 100644
--- a/src/libstd/unstable/lang.rs
+++ b/src/libstd/unstable/lang.rs
@@ -13,7 +13,7 @@
 use c_str::ToCStr;
 use cast::transmute;
 use libc::{c_char, c_void, size_t, uintptr_t};
-use option::{Some, None};
+use option::{Option, None, Some};
 use sys;
 use rt::task::Task;
 use rt::local::Local;
@@ -37,7 +37,8 @@ pub fn fail_bounds_check(file: *c_char, line: size_t,
 #[lang="malloc"]
 pub unsafe fn local_malloc(td: *c_char, size: uintptr_t) -> *c_char {
     // XXX: Unsafe borrow for speed. Lame.
-    match Local::try_unsafe_borrow::<Task>() {
+    let task: Option<*mut Task> = Local::try_unsafe_borrow();
+    match task {
         Some(task) => {
             (*task).heap.alloc(td as *c_void, size as uint) as *c_char
         }
diff --git a/src/libstd/unstable/sync.rs b/src/libstd/unstable/sync.rs
index cf8ec968e92..8d1545ea2b4 100644
--- a/src/libstd/unstable/sync.rs
+++ b/src/libstd/unstable/sync.rs
@@ -279,7 +279,8 @@ pub unsafe fn atomically<U>(f: &fn() -> U) -> U {
     use rt::task::{Task, GreenTask, SchedTask};
     use rt::local::Local;
 
-    match Local::try_unsafe_borrow::<Task>() {
+    let task_opt: Option<*mut Task> = Local::try_unsafe_borrow();
+    match task_opt {
         Some(t) => {
             match (*t).task_type {
                 GreenTask(_) => {
diff --git a/src/libstd/util.rs b/src/libstd/util.rs
index b46876ad3fe..5085f337d4b 100644
--- a/src/libstd/util.rs
+++ b/src/libstd/util.rs
@@ -54,8 +54,10 @@ pub fn swap<T>(x: &mut T, y: &mut T) {
         let t: *mut T = &mut tmp;
 
         // Perform the swap, `&mut` pointers never alias
-        ptr::copy_nonoverlapping_memory(t, x, 1);
-        ptr::copy_nonoverlapping_memory(x, y, 1);
+        let x_raw: *mut T = x;
+        let y_raw: *mut T = y;
+        ptr::copy_nonoverlapping_memory(t, x_raw, 1);
+        ptr::copy_nonoverlapping_memory(x, y_raw, 1);
         ptr::copy_nonoverlapping_memory(y, t, 1);
 
         // y and t now point to the same thing, but we need to completely forget `tmp`
diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs
index 556842e6544..8cd1b09468d 100644
--- a/src/libstd/vec.rs
+++ b/src/libstd/vec.rs
@@ -1122,14 +1122,7 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] {
      * foreign interop.
      */
     #[inline]
-    fn as_imm_buf<U>(&self,
-                     /* NB---this CANNOT be const, see below */
-                     f: &fn(*T, uint) -> U) -> U {
-        // NB---Do not change the type of s to `&const [T]`.  This is
-        // unsound.  The reason is that we are going to create immutable pointers
-        // into `s` and pass them to `f()`, but in fact they are potentially
-        // pointing at *mutable memory*.  Use `as_mut_buf` instead!
-
+    fn as_imm_buf<U>(&self, f: &fn(*T, uint) -> U) -> U {
         let s = self.repr();
         f(s.data, s.len / sys::nonzero_size_of::<T>())
     }