rust-lang / rust-lang/rust-bindgen

--disable-name-namespacing has no effect on vtable functions

Open
#2,438 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-C++
Dominant language
Rust
Stars
5.3k
Forks
829
Avg merge
1d 1h
Merged PRs (30d)
15

Description

Input C/C++ Header
class TestClass {
public:
	virtual void method() = 0;
};
Bindgen Invocation
$ bindgen input.h --vtable-generation --disable-name-namespacing header.h -- -x c++
Actual Results
#[repr(C)]
pub struct TestClass__bindgen_vtable {
    pub TestClass_method: unsafe extern "C" fn(this: *mut TestClass),
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct TestClass {
    pub vtable_: *const TestClass__bindgen_vtable,
}
Expected Results

The TestClass prefix for TestClass_method should be removed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the shown C++ header and bindgen invocation using --vtable-generation and --disable-name-namespacing. Trace the vtable-generation and name-namespacing handling, then verify that the generated vtable function no longer includes the TestClass prefix while the expected TestClass binding remains valid.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, rust
Domain
compilers, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.