rust-lang / rust-lang/rust-bindgen

Renaming a `using` defined template type lose generic definition

Open
#2,010 1 comment 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

Input C/C++ Header
template <typename T, int N>
using array_field = T[N];

template <typename T, int N>
using renamed = array_field<T, N>;
Bindgen Invocation
$ bindgen array.hh -- -std=c++17
Actual Results
/* automatically generated by rust-bindgen 0.57.0 */

pub type array_field<T> = *mut T;
pub type renamed = array_field<T>;
Expected Results
/* automatically generated by rust-bindgen 0.57.0 */

pub type array_field<T> = *mut T;
pub type renamed<T> = array_field<T>;

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++ aliases in array.hh and the bindgen command using -std=c++17. Trace how bindgen emits generic aliases, then compare the generated output with the expected generic renamed alias. Done when renamed retains its T parameter and the regression is covered by a test.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.