diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2022-02-18 19:47:12 +0100 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2022-02-18 20:11:57 +0100 |
commit | cd78b6540789b22b79c1058fec4fdfe3449ea50e (patch) | |
tree | 1f18bf5670c52ebeaafdb2274e39511a6b40f69e | |
parent | 68d2b0e0f8a4766ad5f73ae92c5e1e7be36df7f3 (diff) |
codegen: Use raw pointers rather than references in vtable functions.
Closes #2163
-rw-r--r-- | src/codegen/mod.rs | 4 | ||||
-rw-r--r-- | tests/expectations/tests/enum_and_vtable_mangling.rs | 2 | ||||
-rw-r--r-- | tests/expectations/tests/nested_vtable.rs | 2 | ||||
-rw-r--r-- | tests/expectations/tests/ref_argument_array.rs | 2 | ||||
-rw-r--r-- | tests/expectations/tests/virtual_interface.rs | 6 | ||||
-rw-r--r-- | tests/expectations/tests/virtual_overloaded.rs | 4 | ||||
-rw-r--r-- | tests/expectations/tests/vtable_recursive_sig.rs | 2 |
7 files changed, 11 insertions, 11 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index 3face264..ffb21d13 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -1077,9 +1077,9 @@ impl<'a> CodeGenerator for Vtable<'a> { let ret = utils::fnsig_return_ty(ctx, signature); args[0] = if m.is_const() { - quote! { this: & #class_ident } + quote! { this: *const #class_ident } } else { - quote! { this: &mut #class_ident } + quote! { this: *mut #class_ident } }; Some(quote! { diff --git a/tests/expectations/tests/enum_and_vtable_mangling.rs b/tests/expectations/tests/enum_and_vtable_mangling.rs index bd6f7ff6..5ae76c4c 100644 --- a/tests/expectations/tests/enum_and_vtable_mangling.rs +++ b/tests/expectations/tests/enum_and_vtable_mangling.rs @@ -15,7 +15,7 @@ pub enum _bindgen_ty_1 { } #[repr(C)] pub struct C__bindgen_vtable { - pub C_match: unsafe extern "C" fn(this: &mut C), + pub C_match: unsafe extern "C" fn(this: *mut C), } #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/nested_vtable.rs b/tests/expectations/tests/nested_vtable.rs index 8747a59f..7ee48304 100644 --- a/tests/expectations/tests/nested_vtable.rs +++ b/tests/expectations/tests/nested_vtable.rs @@ -8,7 +8,7 @@ #[repr(C)] pub struct nsISupports__bindgen_vtable { pub nsISupports_QueryInterface: - unsafe extern "C" fn(this: &mut nsISupports) -> *mut nsISupports, + unsafe extern "C" fn(this: *mut nsISupports) -> *mut nsISupports, } #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/ref_argument_array.rs b/tests/expectations/tests/ref_argument_array.rs index a99bf2c3..00a8e0ee 100644 --- a/tests/expectations/tests/ref_argument_array.rs +++ b/tests/expectations/tests/ref_argument_array.rs @@ -9,7 +9,7 @@ pub const NSID_LENGTH: u32 = 10; #[repr(C)] pub struct nsID__bindgen_vtable { pub nsID_ToProvidedString: unsafe extern "C" fn( - this: &mut nsID, + this: *mut nsID, aDest: *mut [::std::os::raw::c_char; 10usize], ), } diff --git a/tests/expectations/tests/virtual_interface.rs b/tests/expectations/tests/virtual_interface.rs index 7677c51f..be94f232 100644 --- a/tests/expectations/tests/virtual_interface.rs +++ b/tests/expectations/tests/virtual_interface.rs @@ -7,9 +7,9 @@ #[repr(C)] pub struct PureVirtualIFace__bindgen_vtable { - pub PureVirtualIFace_Foo: unsafe extern "C" fn(this: &mut PureVirtualIFace), + pub PureVirtualIFace_Foo: unsafe extern "C" fn(this: *mut PureVirtualIFace), pub PureVirtualIFace_Bar: unsafe extern "C" fn( - this: &mut PureVirtualIFace, + this: *mut PureVirtualIFace, arg1: ::std::os::raw::c_uint, ), } @@ -42,7 +42,7 @@ impl Default for PureVirtualIFace { } #[repr(C)] pub struct AnotherInterface__bindgen_vtable { - pub AnotherInterface_Baz: unsafe extern "C" fn(this: &mut AnotherInterface), + pub AnotherInterface_Baz: unsafe extern "C" fn(this: *mut AnotherInterface), } #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/virtual_overloaded.rs b/tests/expectations/tests/virtual_overloaded.rs index 3fcfe33e..c117d9ef 100644 --- a/tests/expectations/tests/virtual_overloaded.rs +++ b/tests/expectations/tests/virtual_overloaded.rs @@ -8,9 +8,9 @@ #[repr(C)] pub struct C__bindgen_vtable { pub C_do_thing: - unsafe extern "C" fn(this: &mut C, arg1: ::std::os::raw::c_char), + unsafe extern "C" fn(this: *mut C, arg1: ::std::os::raw::c_char), pub C_do_thing1: - unsafe extern "C" fn(this: &mut C, arg1: ::std::os::raw::c_int), + unsafe extern "C" fn(this: *mut C, arg1: ::std::os::raw::c_int), } #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/vtable_recursive_sig.rs b/tests/expectations/tests/vtable_recursive_sig.rs index dd1b0f4d..74e1dc79 100644 --- a/tests/expectations/tests/vtable_recursive_sig.rs +++ b/tests/expectations/tests/vtable_recursive_sig.rs @@ -7,7 +7,7 @@ #[repr(C)] pub struct Base__bindgen_vtable { - pub Base_AsDerived: unsafe extern "C" fn(this: &mut Base) -> *mut Derived, + pub Base_AsDerived: unsafe extern "C" fn(this: *mut Base) -> *mut Derived, } #[repr(C)] #[derive(Debug, Copy, Clone)] |