diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index c57a465df3780..765c9827cb79f 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -231,7 +231,7 @@ impl Vec { /// } /// /// // Put everything back together into a Vec - /// let rebuilt = Vec::from_raw_parts(len, cap, p); + /// let rebuilt = Vec::from_raw_parts(p, len, cap); /// assert_eq!(rebuilt, vec![4i, 5i, 6i]); /// } /// } diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index f7a84fc3478b9..c2e88bfdbcfb9 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -259,9 +259,9 @@ impl OwnedAsciiCast for Vec { #[inline] unsafe fn into_ascii_nocheck(self) -> Vec { - let v = Vec::from_raw_parts(self.len(), - self.capacity(), - mem::transmute(self.as_ptr())); + let v = Vec::from_raw_parts(self.as_ptr() as *mut Ascii, + self.len(), + self.capacity()); // We forget `self` to avoid freeing it at the end of the scope // Otherwise, the returned `Vec` would point to freed memory @@ -345,9 +345,9 @@ pub trait IntoBytes { impl IntoBytes for Vec { fn into_bytes(self) -> Vec { unsafe { - let v = Vec::from_raw_parts(self.len(), - self.capacity(), - mem::transmute(self.as_ptr())); + let v = Vec::from_raw_parts(self.as_ptr() as *mut u8, + self.len(), + self.capacity()); // We forget `self` to avoid freeing it at the end of the scope // Otherwise, the returned `Vec` would point to freed memory diff --git a/src/test/run-pass/issue-17458.rs b/src/test/compile-fail/issue-17458.rs similarity index 88% rename from src/test/run-pass/issue-17458.rs rename to src/test/compile-fail/issue-17458.rs index a32a31e97e3e0..b1fbe6f5549e4 100644 --- a/src/test/run-pass/issue-17458.rs +++ b/src/test/compile-fail/issue-17458.rs @@ -9,6 +9,7 @@ // except according to those terms. static X: uint = 0 as *const uint as uint; +//~^ ERROR: can not cast a pointer to an integer in a constant expression fn main() { assert_eq!(X, 0); diff --git a/src/test/run-pass/issue-16668.rs b/src/test/run-pass/issue-16668.rs index 1bfa79b8a110d..b66fb4306d029 100644 --- a/src/test/run-pass/issue-16668.rs +++ b/src/test/run-pass/issue-16668.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-pretty + #![feature(unboxed_closures)] struct Parser<'a, I, O> {