servo / rust-mozjs

DEPRECATED - moved to servo/mozjs instead.
Mozilla Public License 2.0
293 stars 117 forks source link

Error E0277 on nightly #196

Closed llacroix closed 9 years ago

llacroix commented 9 years ago

error: the trait core::clone::Clone is not implemented for the type unsafe extern "C" fn(*mut jsapi::JSContext, jsapi::Handle<*mut jsapi::JSObject>, jsapi::Handle<jsapi::jsid>, jsapi::Handle<jsapi::Value>, core::option::Option<unsafe extern "C" fn(*mut jsapi::JSContext, jsapi::Handle<*mut jsapi::JSObject>, jsapi::Handle<jsapi::jsid>, jsapi::MutableHandle<jsapi::Value>) -> u8>, core::option::Option<unsafe extern "C" fn(*mut jsapi::JSContext, jsapi::Handle<*mut jsapi::JSObject>, jsapi::Handle<jsapi::jsid>, jsapi::MutableHandle<jsapi::Value>, *mut jsapi::ObjectOpResult) -> u8>, u32, *mut jsapi::ObjectOpResult) -> u8 [E0277] /home/llacroix/.cargo/git/checkouts/rust-mozjs-ebb4917e843c0a11/master/src/jsapi.rs:980 pub defineProperty: DefinePropertyOp, /home/llacroix/.cargo/git/checkouts/rust-mozjs-ebb4917e843c0a11/master/src/jsapi.rs:977:16: 977:21 note: in this expansion of #[derive_Clone](defined in /home/llacroix/.cargo/git/checkouts/rust-mozjs-ebb4917e843c0a11/master/src/jsapi.rs)

I'm on nightly from 17/09/2015

jdm commented 9 years ago

https://github.com/rust-lang/rust/issues/28229 perhaps?

bjwbell commented 9 years ago

@jdm doesn't seem like it. https://github.com/rust-lang/rust/issues/28229 exists with rustc 1.4.0-nightly (7780408af 2015-09-01) but rust-mozjs compiles ok.

llacroix commented 9 years ago

@bjwbell I'll give a try with this version. It could be good to point out which rust version compile fine rust-mozjs.

llacroix commented 9 years ago

The problem seems to happen on these definitions:

pub type ReadTransferStructuredCloneOp =                                                                   
::std::option::Option<unsafe extern "C" fn
                          (cx: *mut JSContext,
                           r: *mut JSStructuredCloneReader, tag: u32,
                           content: *mut ::libc::c_void, extraData: u64,
                           closure: *mut ::libc::c_void,
                           returnObject: MutableHandleObject) -> u8>;
pub type TransferStructuredCloneOp =
::std::option::Option<unsafe extern "C" fn
                          (cx: *mut JSContext, obj: Handle<*mut JSObject>,
                           closure: *mut ::libc::c_void, tag: *mut u32,
                           ownership: *mut TransferableOwnership,
                           content: *mut *mut ::libc::c_void,
                           extraData: *mut u64) -> u8>;

pub type GetPropertyOp =                                                                                                     
::std::option::Option<unsafe extern "C" fn
                          (cx: *mut JSContext, obj: HandleObject,
                           receiver: HandleObject, id: HandleId,
                           vp: MutableHandleValue) -> u8>;
pub type SetPropertyOp =
::std::option::Option<unsafe extern "C" fn
                          (cx: *mut JSContext, obj: HandleObject,
                           receiver: HandleObject, id: HandleId,
                           vp: MutableHandleValue,
                           result: *mut ObjectOpResult) -> u8>;

pub type OpenAsmJSCacheEntryForReadOp =                                                   
::std::option::Option<unsafe extern "C" fn
                          (global: HandleObject, begin: *const i16,
                           limit: *const i16, size: *mut u32,
                           memory: *mut *const u8, handle: *mut i32)
                          -> u8>;
pub type CloseAsmJSCacheEntryForReadOp =
::std::option::Option<unsafe extern "C" fn
                          (size: u32, memory: *const u8, handle: i32)>;

Those six entries are causing the same error while expending [#derive_Clone] I'm not sure how those object types are much different from the other ones... As all the object I see that are declared in the struct are also Option.

jdm commented 9 years ago

I suspect it's the arguments that are raw pointers that are triggering this error, incorrectly.

Manishearth commented 9 years ago

This is a regression, https://github.com/rust-lang/rust/issues/28559

llacroix commented 9 years ago

problem solved with this fix