rust-lang / rust-lang/rust-bindgen

expected type, found static

Open
#999 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-C++ A-spe A-templates I-bogus-codegen
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]
error[E0573]: expected type, found static `c`
 --> /tmp/bindings-hZ74UX.rs:4:26
  |
4 |  pub static mut  c  :  [ c ; 0usize ] ;
  |                          ^ did you mean `b`?

error: aborting due to previous error

Interesting: bindgen emitted Rust code that won't compile!

$ cat abc.h

template < typename a > struct b
{
  static a c[];
};
template < typename c > c b < c >::c[0];

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 the b.sh script, bindgen revision 4dd4ac7, and the abc.h example. Inspect the generated /tmp/bindings-hZ74UX.rs around the static array declaration and verify that the generated Rust compiles for this C++ input.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.