Fix build with stable Rust.

This commit is contained in:
Daniel Grunwald 2016-03-12 20:20:41 +01:00
parent b43fa55e01
commit e608d5eabe
2 changed files with 10 additions and 0 deletions

View File

@ -167,6 +167,7 @@ pub unsafe fn handle_callback<F, T>(location: &str, f: F) -> *mut ffi::PyObject
ret ret
} }
#[cfg(feature="nightly")]
fn handle_panic(_py: Python, _panic: &any::Any) -> *mut ffi::PyObject { fn handle_panic(_py: Python, _panic: &any::Any) -> *mut ffi::PyObject {
let msg = cstr!("Rust panic"); let msg = cstr!("Rust panic");
unsafe { unsafe {

View File

@ -64,11 +64,20 @@ pub unsafe fn data_init<'a, T>(_py: Python<'a>, obj: &'a PyObject, offset: usize
#[inline] #[inline]
#[doc(hidden)] #[doc(hidden)]
#[cfg(feature="nightly")]
pub unsafe fn data_drop<'a, T>(_py: Python<'a>, obj: *mut ffi::PyObject, offset: usize) { pub unsafe fn data_drop<'a, T>(_py: Python<'a>, obj: *mut ffi::PyObject, offset: usize) {
let ptr = (obj as *mut u8).offset(offset as isize) as *mut T; let ptr = (obj as *mut u8).offset(offset as isize) as *mut T;
ptr::drop_in_place(ptr) ptr::drop_in_place(ptr)
} }
#[inline]
#[doc(hidden)]
#[cfg(not(feature="nightly"))]
pub unsafe fn data_drop<'a, T>(_py: Python<'a>, obj: *mut ffi::PyObject, offset: usize) {
let ptr = (obj as *mut u8).offset(offset as isize) as *mut T;
ptr::read(ptr);
}
#[inline] #[inline]
#[doc(hidden)] #[doc(hidden)]
pub fn is_ready(_py: Python, ty: &ffi::PyTypeObject) -> bool { pub fn is_ready(_py: Python, ty: &ffi::PyTypeObject) -> bool {