rust-lang / rust-lang/rust-bindgen

Hang in the test-case from #1127 with extra assertions.

Open
#1,129 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

With the fix for the panic in #1128, we get through it and generate code correctly, but on llvm 4.0 we generate a cyclic alias reference, so we get stuck resolving items in assert_every_item_in_a_module (enabled only with extra assertions).

The test is:

// bindgen-flags: -- -std=c++11

template <typename> struct A;
template <typename, typename, bool> struct _Map_base;
template <typename _Pair, typename _Traits>
struct _Map_base<_Pair, _Traits, true> {
  using __hashtable_base = A<_Traits>;
  using key_type = typename __hashtable_base::key_type;
  using mapped_type = typename _Pair::type;
  mapped_type &at(const key_type &);
};
template <typename _Pair, typename _Traits>
auto _Map_base<_Pair, _Traits, true>::at(const key_type &) -> mapped_type & {}

The method definition does surprisingly matter, so there's something fishy going on there, but I'm punting on landing the test-case for now because the fix fixes the issue, and also unblocks updating bindgen in mozilla-central.

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

Start with the provided C++11 reproducer and the extra-assertions path in assert_every_item_in_a_module, comparing behavior on LLVM 4.0. Trace why the generated cyclic alias is not resolved and confirm that the hang no longer occurs after the issue is addressed; the report notes that the method definition is significant.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, rust
Domain
compilers, devtools
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.