rust-lang / rust-lang/rust-bindgen

Unable to generate bindings due to a delegation cycle

Open
#993 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-C++ A-error-reporting A-libclang A-spe I-panic
Dominant language
Rust
Stars
5.3k
Forks
829
Avg merge
1d 1h
Merged PRs (30d)
15

Description

I am using this script https://gist.github.com/fitzgen/187381e358f60efa8194d0b276b4d11a.

The hashtag for my bindgen version is 4dd4ac7 .

$ ./b.sh bindgen abc.h

clang-4.0: warning: treating 'c-header' input as 'c++-header' when in C++ mode, this behavior is deprecated [-Wdeprecated]
abc.h:5:14: error: constructor for 'a' creates a delegation cycle [-Wdelegating-ctor-cycles]
abc.h:5:14: error: constructor for 'a' creates a delegation cycle [-Wdelegating-ctor-cycles], err: true
thread 'main' panicked at 'Unable to generate bindings: ()', /checkout/src/libcore/result.rs:860:4
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
             at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at /checkout/src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at /checkout/src/libstd/sys_common/backtrace.rs:60
             at /checkout/src/libstd/panicking.rs:380
   3: std::panicking::default_hook
             at /checkout/src/libstd/panicking.rs:396
   4: std::panicking::rust_panic_with_hook
             at /checkout/src/libstd/panicking.rs:611
   5: std::panicking::begin_panic_new
             at /checkout/src/libstd/panicking.rs:553
   6: std::panicking::begin_panic_fmt
             at /checkout/src/libstd/panicking.rs:521
   7: rust_begin_unwind
             at /checkout/src/libstd/panicking.rs:497
   8: core::panicking::panic_fmt
             at /checkout/src/libcore/panicking.rs:92
   9: core::result::unwrap_failed
             at /checkout/src/libcore/macros.rs:41
  10: <core::result::Result<T, E>>::expect
             at /checkout/src/libcore/result.rs:762
  11: bindgen::main::{{closure}}
             at src/main.rs:55
  12: std::panicking::try::do_call
             at /checkout/src/libstd/panicking.rs:479
  13: __rust_maybe_catch_panic
             at /checkout/src/libpanic_unwind/lib.rs:98
  14: std::panicking::try
             at /checkout/src/libstd/panicking.rs:458
  15: std::panic::catch_unwind
             at /checkout/src/libstd/panic.rs:361
  16: bindgen::main
             at src/main.rs:54
  17: __rust_maybe_catch_panic
             at /checkout/src/libpanic_unwind/lib.rs:98
  18: std::rt::lang_start
             at /checkout/src/libstd/panicking.rs:458
             at /checkout/src/libstd/panic.rs:361
             at /checkout/src/libstd/rt.rs:59
  19: main
  20: __libc_start_main
  21: _start
Interesting: bindgen failed to generate bindings for the test case!

$ cat abc.h

namespace
{
  struct a
  {
    a (bool):a (new int)
    {
    }
  };
}

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 failure with b.sh bindgen abc.h using the script and header from the issue. Start at src/main.rs:55, where the panic is reported, then trace the binding-generation error path and compare its handling of the clang delegation-cycle diagnostics with the issue output. Done means the behavior for this input is covered by a verified regression test and no longer matches the reported failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, rust
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.