Test fixes and rebase conflicts from rollup

This commit is contained in:
Alex Crichton
2014-10-27 09:11:07 -07:00
parent 40811f84ef
commit a33d7617c5
4 changed files with 10 additions and 7 deletions

View File

@@ -231,7 +231,7 @@ impl<T> Vec<T> {
/// } /// }
/// ///
/// // Put everything back together into a 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]); /// assert_eq!(rebuilt, vec![4i, 5i, 6i]);
/// } /// }
/// } /// }

View File

@@ -259,9 +259,9 @@ impl OwnedAsciiCast for Vec<u8> {
#[inline] #[inline]
unsafe fn into_ascii_nocheck(self) -> Vec<Ascii> { unsafe fn into_ascii_nocheck(self) -> Vec<Ascii> {
let v = Vec::from_raw_parts(self.len(), let v = Vec::from_raw_parts(self.as_ptr() as *mut Ascii,
self.capacity(), self.len(),
mem::transmute(self.as_ptr())); self.capacity());
// We forget `self` to avoid freeing it at the end of the scope // We forget `self` to avoid freeing it at the end of the scope
// Otherwise, the returned `Vec` would point to freed memory // Otherwise, the returned `Vec` would point to freed memory
@@ -345,9 +345,9 @@ pub trait IntoBytes {
impl IntoBytes for Vec<Ascii> { impl IntoBytes for Vec<Ascii> {
fn into_bytes(self) -> Vec<u8> { fn into_bytes(self) -> Vec<u8> {
unsafe { unsafe {
let v = Vec::from_raw_parts(self.len(), let v = Vec::from_raw_parts(self.as_ptr() as *mut u8,
self.capacity(), self.len(),
mem::transmute(self.as_ptr())); self.capacity());
// We forget `self` to avoid freeing it at the end of the scope // We forget `self` to avoid freeing it at the end of the scope
// Otherwise, the returned `Vec` would point to freed memory // Otherwise, the returned `Vec` would point to freed memory

View File

@@ -9,6 +9,7 @@
// except according to those terms. // except according to those terms.
static X: uint = 0 as *const uint as uint; static X: uint = 0 as *const uint as uint;
//~^ ERROR: can not cast a pointer to an integer in a constant expression
fn main() { fn main() {
assert_eq!(X, 0); assert_eq!(X, 0);

View File

@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
// ignore-pretty
#![feature(unboxed_closures)] #![feature(unboxed_closures)]
struct Parser<'a, I, O> { struct Parser<'a, I, O> {