Skip to content

Commit 3fda15e

Browse files
author
bors-servo
committed
Auto merge of #20 - alexcrichton:no-intrinsics, r=SimonSapin
Avoid using the std::intrinsics module This is actually unstable but [there's a bug][bug] in the compiler allowing it to be used. Good news is that these functions are available stable elsewhere! [bug]: rust-lang/rust#28075 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/tendril/20) <!-- Reviewable:end -->
2 parents 10427db + d72cf3b commit 3fda15e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/tendril.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// option. This file may not be copied, modified, or distributed
55
// except according to those terms.
66

7-
use std::{ptr, mem, intrinsics, hash, str, u32, io, slice, cmp};
7+
use std::{ptr, mem, hash, str, u32, io, slice, cmp};
88
use std::sync::atomic::{self, AtomicUsize};
99
use std::sync::atomic::Ordering as AtomicOrdering;
1010
use std::borrow::{Borrow, Cow};
@@ -1013,7 +1013,7 @@ impl<F, A> Tendril<F, A>
10131013
marker: PhantomData,
10141014
refcount_marker: PhantomData,
10151015
};
1016-
intrinsics::copy_nonoverlapping(x.as_ptr(), &mut t.len as *mut u32 as *mut u8, len);
1016+
ptr::copy_nonoverlapping(x.as_ptr(), &mut t.len as *mut u32 as *mut u8, len);
10171017
t
10181018
}
10191019

@@ -1032,7 +1032,7 @@ impl<F, A> Tendril<F, A>
10321032
unsafe fn owned_copy(x: &[u8]) -> Tendril<F, A> {
10331033
let len32 = x.len() as u32;
10341034
let mut b = Buf32::with_capacity(len32, Header::new());
1035-
intrinsics::copy_nonoverlapping(x.as_ptr(), b.data_ptr(), x.len());
1035+
ptr::copy_nonoverlapping(x.as_ptr(), b.data_ptr(), x.len());
10361036
b.len = len32;
10371037
Tendril::owned(b)
10381038
}

src/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// option. This file may not be copied, modified, or distributed
55
// except according to those terms.
66

7-
use std::{slice, intrinsics};
7+
use std::{slice, ptr};
88
use std::mem;
99

1010
#[inline(always)]
@@ -23,7 +23,7 @@ pub unsafe fn unsafe_slice_mut<'a>(buf: &'a mut [u8], start: usize, new_len: usi
2323

2424
#[inline(always)]
2525
pub unsafe fn copy_and_advance(dest: &mut *mut u8, src: &[u8]) {
26-
intrinsics::copy_nonoverlapping(src.as_ptr(), *dest, src.len());
26+
ptr::copy_nonoverlapping(src.as_ptr(), *dest, src.len());
2727
*dest = dest.offset(src.len() as isize)
2828
}
2929

0 commit comments

Comments
 (0)