diff options
-rw-r--r-- | libbindgen/src/codegen/mod.rs | 2 | ||||
-rw-r--r-- | libbindgen/tests/expectations/tests/method-mangling.rs | 29 | ||||
-rw-r--r-- | libbindgen/tests/headers/method-mangling.hpp | 5 |
3 files changed, 35 insertions, 1 deletions
diff --git a/libbindgen/src/codegen/mod.rs b/libbindgen/src/codegen/mod.rs index bf516cd2..9ab264c6 100644 --- a/libbindgen/src/codegen/mod.rs +++ b/libbindgen/src/codegen/mod.rs @@ -1404,7 +1404,7 @@ impl MethodCodegen for Method { let item = ast::ImplItem { id: ast::DUMMY_NODE_ID, - ident: ctx.ext_cx().ident_of(&name), + ident: ctx.rust_ident(&name), vis: ast::Visibility::Public, attrs: attrs, node: ast::ImplItemKind::Method(sig, P(block)), diff --git a/libbindgen/tests/expectations/tests/method-mangling.rs b/libbindgen/tests/expectations/tests/method-mangling.rs new file mode 100644 index 00000000..3b5107a8 --- /dev/null +++ b/libbindgen/tests/expectations/tests/method-mangling.rs @@ -0,0 +1,29 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(non_snake_case)] + + +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Foo { + pub _address: u8, +} +#[test] +fn bindgen_test_layout_Foo() { + assert_eq!(::std::mem::size_of::<Foo>() , 1usize); + assert_eq!(::std::mem::align_of::<Foo>() , 1usize); +} +extern "C" { + #[link_name = "_ZN3Foo4typeEv"] + pub fn Foo_type(this: *mut Foo) -> ::std::os::raw::c_int; +} +impl Clone for Foo { + fn clone(&self) -> Self { *self } +} +impl Foo { + #[inline] + pub unsafe fn type_(&mut self) -> ::std::os::raw::c_int { + Foo_type(&mut *self) + } +} diff --git a/libbindgen/tests/headers/method-mangling.hpp b/libbindgen/tests/headers/method-mangling.hpp new file mode 100644 index 00000000..0dac4975 --- /dev/null +++ b/libbindgen/tests/headers/method-mangling.hpp @@ -0,0 +1,5 @@ + +class Foo { +public: + int type(); +}; |