From 5a08e679c792cbb5110c18d80a5090ad31bb103a Mon Sep 17 00:00:00 2001 From: Joonas Javanainen Date: Fri, 21 Nov 2014 15:12:08 +0000 Subject: Fix std::fmt::Binary format char in docs This small piece of documentation was missed in the format character change in 4af3494bb02e80badc978faa65e59625ade0c675. --- src/libcore/fmt/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libcore') diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index be8828b3ec8..6e77b0a7c79 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -179,7 +179,7 @@ pub trait Octal for Sized? { fn fmt(&self, &mut Formatter) -> Result; } -/// Format trait for the `t` character +/// Format trait for the `b` character #[unstable = "I/O and core have yet to be reconciled"] pub trait Binary for Sized? { /// Formats the value using the given formatter. -- cgit 1.4.1-3-g733a5 From 1b17eefa4aff87ae393c6d5aff7e90ff7c3c3185 Mon Sep 17 00:00:00 2001 From: Jonathan Reem Date: Sat, 22 Nov 2014 16:06:21 -0800 Subject: Any: use plain transmute instead of transmute_copy for downcasting. transmute_copy is no longer needed and is just slow. --- src/liballoc/boxed.rs | 10 +++------- src/libcore/any.rs | 6 +++--- 2 files changed, 6 insertions(+), 10 deletions(-) (limited to 'src/libcore') diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 26f8522e1c1..000dda59e3d 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -15,7 +15,6 @@ use core::clone::Clone; use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering}; use core::default::Default; use core::fmt; -use core::intrinsics; use core::kinds::Sized; use core::mem; use core::option::Option; @@ -104,17 +103,14 @@ pub trait BoxAny { } #[stable] -impl BoxAny for Box { +impl BoxAny for Box { #[inline] - fn downcast(self) -> Result, Box> { + fn downcast(self) -> Result, Box> { if self.is::() { unsafe { // Get the raw representation of the trait object let to: TraitObject = - *mem::transmute::<&Box, &TraitObject>(&self); - - // Prevent destructor on self being run - intrinsics::forget(self); + mem::transmute::, TraitObject>(self); // Extract the data pointer Ok(mem::transmute(to.data)) diff --git a/src/libcore/any.rs b/src/libcore/any.rs index 5511266b4cd..ebd6fab34e9 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -71,7 +71,7 @@ #![stable] -use mem::{transmute, transmute_copy}; +use mem::{transmute}; use option::{Option, Some, None}; use raw::TraitObject; use intrinsics::TypeId; @@ -134,7 +134,7 @@ impl<'a> AnyRefExt<'a> for &'a Any { if self.is::() { unsafe { // Get the raw representation of the trait object - let to: TraitObject = transmute_copy(&self); + let to: TraitObject = transmute(self); // Extract the data pointer Some(transmute(to.data)) @@ -162,7 +162,7 @@ impl<'a> AnyMutRefExt<'a> for &'a mut Any { if self.is::() { unsafe { // Get the raw representation of the trait object - let to: TraitObject = transmute_copy(&self); + let to: TraitObject = transmute(self); // Extract the data pointer Some(transmute(to.data)) -- cgit 1.4.1-3-g733a5 From b637a867a52b94a0e1492aebc262c36b8f4b860b Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Sat, 22 Nov 2014 22:13:00 -0500 Subject: Fix typo in Result documentation --- src/libcore/result.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libcore') diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 16798c039ba..3240b4207a1 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -57,7 +57,7 @@ //! //! Pattern matching on `Result`s is clear and straightforward for //! simple cases, but `Result` comes with some convenience methods -//! that make working it more succinct. +//! that make working with it more succinct. //! //! ``` //! let good_result: Result = Ok(10); -- cgit 1.4.1-3-g733a5