rust-lang / rust-lang/rust-bindgen

bindgen hangs on c++ header

Open
#1,918 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

c++ header

template <typename> struct a;
template <typename, typename, typename, typename, typename, typename, typename, typename, typename, bool> struct b;
template <typename d, typename c, typename f, typename e, typename h, typename g, typename j, typename i, typename l>
struct b<d, c, f, e, h, g, j, i, l, true> {
  using k = a<l>;
  using n = typename k::n;
  using m = typename c ::o;
  m &p(const n &);
};
template <typename d, typename c, typename f, typename e, typename h, typename g, typename j, typename i, typename l>
auto b<d, c, f, e, h, g, j, i, l, true>::p(const n &) -> m & {}

bindgen test-case-5.hpp -- -x c++ hangs.

This hangs bindgen for at least several minutes. The interestingness test I used with creduce was that it would hang it for 2m:30s.

Using RUST_LOG=bindgen on the executable shows that it gets into the codegen phase.

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

Run bindgen test-case-5.hpp -- -x c++ with RUST_LOG=bindgen and follow the reported codegen phase. Use the provided C++ header as the reproducer; done means bindgen completes instead of hanging, with a regression check for this command.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.