Remove all #[cfg(stage0)]-protected code
New snapshot means this can all go. Also removes places that have comments that say they are workarounds for stage0 errors.
This commit is contained in:
parent
6759ce4fd2
commit
3bc4d1a120
20 changed files with 15 additions and 369 deletions
|
|
@ -14,21 +14,8 @@ use sys;
|
|||
use unstable::intrinsics;
|
||||
|
||||
/// Casts the value at `src` to U. The two types must have the same length.
|
||||
#[cfg(stage0)]
|
||||
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
|
||||
let mut dest: U = intrinsics::uninit();
|
||||
{
|
||||
let dest_ptr: *mut u8 = transmute(&mut dest);
|
||||
let src_ptr: *u8 = transmute(src);
|
||||
intrinsics::memmove64(dest_ptr,
|
||||
src_ptr,
|
||||
sys::size_of::<U>() as u64);
|
||||
}
|
||||
dest
|
||||
}
|
||||
|
||||
/// Casts the value at `src` to U. The two types must have the same length.
|
||||
#[cfg(target_word_size = "32", not(stage0))]
|
||||
#[cfg(target_word_size = "32")]
|
||||
#[inline]
|
||||
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
|
||||
let mut dest: U = intrinsics::uninit();
|
||||
|
|
@ -39,7 +26,7 @@ pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
|
|||
}
|
||||
|
||||
/// Casts the value at `src` to U. The two types must have the same length.
|
||||
#[cfg(target_word_size = "64", not(stage0))]
|
||||
#[cfg(target_word_size = "64")]
|
||||
#[inline]
|
||||
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
|
||||
let mut dest: U = intrinsics::uninit();
|
||||
|
|
|
|||
|
|
@ -57,10 +57,6 @@ they contained the following prologue:
|
|||
#[license = "MIT/ASL2"];
|
||||
#[crate_type = "lib"];
|
||||
|
||||
// NOTE: remove these two attributes after the next snapshot
|
||||
#[no_core]; // for stage0
|
||||
#[allow(unrecognized_lint)]; // otherwise stage0 is seriously ugly
|
||||
|
||||
// Don't link to std. We are std.
|
||||
#[no_std];
|
||||
|
||||
|
|
|
|||
|
|
@ -1654,9 +1654,7 @@ impl Writer for BytesWriter {
|
|||
vec::reserve(bytes, count);
|
||||
|
||||
unsafe {
|
||||
// Silly stage0 borrow check workaround...
|
||||
let casted: &mut ~[u8] = cast::transmute_copy(&bytes);
|
||||
vec::raw::set_len(casted, count);
|
||||
vec::raw::set_len(bytes, count);
|
||||
|
||||
let view = vec::mut_slice(*bytes, *self.pos, count);
|
||||
vec::bytes::copy_memory(view, v, v_len);
|
||||
|
|
|
|||
|
|
@ -75,21 +75,7 @@ pub fn is_not_null<T>(ptr: *const T) -> bool { !is_null(ptr) }
|
|||
* and destination may overlap.
|
||||
*/
|
||||
#[inline]
|
||||
#[cfg(target_word_size = "32", stage0)]
|
||||
pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
|
||||
use unstable::intrinsics::memmove32;
|
||||
let n = count * sys::size_of::<T>();
|
||||
memmove32(dst as *mut u8, src as *u8, n as u32);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies data from one location to another.
|
||||
*
|
||||
* Copies `count` elements (not bytes) from `src` to `dst`. The source
|
||||
* and destination may overlap.
|
||||
*/
|
||||
#[inline]
|
||||
#[cfg(target_word_size = "32", not(stage0))]
|
||||
#[cfg(target_word_size = "32")]
|
||||
pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
|
||||
use unstable::intrinsics::memmove32;
|
||||
memmove32(dst, src as *T, count as u32);
|
||||
|
|
@ -102,21 +88,7 @@ pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
|
|||
* and destination may overlap.
|
||||
*/
|
||||
#[inline]
|
||||
#[cfg(target_word_size = "64", stage0)]
|
||||
pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
|
||||
use unstable::intrinsics::memmove64;
|
||||
let n = count * sys::size_of::<T>();
|
||||
memmove64(dst as *mut u8, src as *u8, n as u64);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies data from one location to another.
|
||||
*
|
||||
* Copies `count` elements (not bytes) from `src` to `dst`. The source
|
||||
* and destination may overlap.
|
||||
*/
|
||||
#[inline]
|
||||
#[cfg(target_word_size = "64", not(stage0))]
|
||||
#[cfg(target_word_size = "64")]
|
||||
pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
|
||||
use unstable::intrinsics::memmove64;
|
||||
memmove64(dst, src as *T, count as u64);
|
||||
|
|
@ -129,21 +101,7 @@ pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
|
|||
* and destination may *not* overlap.
|
||||
*/
|
||||
#[inline]
|
||||
#[cfg(target_word_size = "32", stage0)]
|
||||
pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: uint) {
|
||||
use unstable::intrinsics::memmove32;
|
||||
let n = count * sys::size_of::<T>();
|
||||
memmove32(dst as *mut u8, src as *u8, n as u32);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies data from one location to another.
|
||||
*
|
||||
* Copies `count` elements (not bytes) from `src` to `dst`. The source
|
||||
* and destination may *not* overlap.
|
||||
*/
|
||||
#[inline]
|
||||
#[cfg(target_word_size = "32", not(stage0))]
|
||||
#[cfg(target_word_size = "32")]
|
||||
pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: uint) {
|
||||
use unstable::intrinsics::memcpy32;
|
||||
memcpy32(dst, src as *T, count as u32);
|
||||
|
|
@ -156,21 +114,7 @@ pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: u
|
|||
* and destination may *not* overlap.
|
||||
*/
|
||||
#[inline]
|
||||
#[cfg(target_word_size = "64", stage0)]
|
||||
pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: uint) {
|
||||
use unstable::intrinsics::memmove64;
|
||||
let n = count * sys::size_of::<T>();
|
||||
memmove64(dst as *mut u8, src as *u8, n as u64);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies data from one location to another.
|
||||
*
|
||||
* Copies `count` elements (not bytes) from `src` to `dst`. The source
|
||||
* and destination may *not* overlap.
|
||||
*/
|
||||
#[inline]
|
||||
#[cfg(target_word_size = "64", not(stage0))]
|
||||
#[cfg(target_word_size = "64")]
|
||||
pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: uint) {
|
||||
use unstable::intrinsics::memcpy64;
|
||||
memcpy64(dst, src as *T, count as u64);
|
||||
|
|
@ -181,7 +125,7 @@ pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: u
|
|||
* bytes of memory starting at `dst` to `c`.
|
||||
*/
|
||||
#[inline]
|
||||
#[cfg(target_word_size = "32", not(stage0))]
|
||||
#[cfg(target_word_size = "32")]
|
||||
pub unsafe fn set_memory<T>(dst: *mut T, c: u8, count: uint) {
|
||||
use unstable::intrinsics::memset32;
|
||||
memset32(dst, c, count as u32);
|
||||
|
|
@ -192,7 +136,7 @@ pub unsafe fn set_memory<T>(dst: *mut T, c: u8, count: uint) {
|
|||
* bytes of memory starting at `dst` to `c`.
|
||||
*/
|
||||
#[inline]
|
||||
#[cfg(target_word_size = "64", not(stage0))]
|
||||
#[cfg(target_word_size = "64")]
|
||||
pub unsafe fn set_memory<T>(dst: *mut T, c: u8, count: uint) {
|
||||
use unstable::intrinsics::memset64;
|
||||
memset64(dst, c, count as u64);
|
||||
|
|
@ -592,7 +536,6 @@ pub mod ptr_tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(stage0))]
|
||||
fn test_set_memory() {
|
||||
let mut xs = [0u8, ..20];
|
||||
let ptr = vec::raw::to_mut_ptr(xs);
|
||||
|
|
|
|||
|
|
@ -130,36 +130,23 @@ pub extern "rust-intrinsic" {
|
|||
|
||||
/// Equivalent to the `llvm.memcpy.p0i8.0i8.i32` intrinsic, with a size of
|
||||
/// `count` * `size_of::<T>()` and an alignment of `min_align_of::<T>()`
|
||||
#[cfg(not(stage0))]
|
||||
pub fn memcpy32<T>(dst: *mut T, src: *T, count: u32);
|
||||
/// Equivalent to the `llvm.memcpy.p0i8.0i8.i64` intrinsic, with a size of
|
||||
/// `count` * `size_of::<T>()` and an alignment of `min_align_of::<T>()`
|
||||
#[cfg(not(stage0))]
|
||||
pub fn memcpy64<T>(dst: *mut T, src: *T, count: u64);
|
||||
|
||||
/// Equivalent to the `llvm.memmove.p0i8.0i8.i32` intrinsic.
|
||||
#[cfg(stage0)]
|
||||
pub fn memmove32(dst: *mut u8, src: *u8, size: u32);
|
||||
/// Equivalent to the `llvm.memmove.p0i8.0i8.i64` intrinsic.
|
||||
#[cfg(stage0)]
|
||||
pub fn memmove64(dst: *mut u8, src: *u8, size: u64);
|
||||
|
||||
/// Equivalent to the `llvm.memmove.p0i8.0i8.i32` intrinsic, with a size of
|
||||
/// `count` * `size_of::<T>()` and an alignment of `min_align_of::<T>()`
|
||||
#[cfg(not(stage0))]
|
||||
pub fn memmove32<T>(dst: *mut T, src: *T, count: u32);
|
||||
/// Equivalent to the `llvm.memmove.p0i8.0i8.i64` intrinsic, with a size of
|
||||
/// `count` * `size_of::<T>()` and an alignment of `min_align_of::<T>()`
|
||||
#[cfg(not(stage0))]
|
||||
pub fn memmove64<T>(dst: *mut T, src: *T, count: u64);
|
||||
|
||||
/// Equivalent to the `llvm.memset.p0i8.i32` intrinsic, with a size of
|
||||
/// `count` * `size_of::<T>()` and an alignment of `min_align_of::<T>()`
|
||||
#[cfg(not(stage0))]
|
||||
pub fn memset32<T>(dst: *mut T, val: u8, count: u32);
|
||||
/// Equivalent to the `llvm.memset.p0i8.i64` intrinsic, with a size of
|
||||
/// `count` * `size_of::<T>()` and an alignment of `min_align_of::<T>()`
|
||||
#[cfg(not(stage0))]
|
||||
pub fn memset64<T>(dst: *mut T, val: u8, count: u64);
|
||||
|
||||
pub fn sqrtf32(x: f32) -> f32;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue