Strange monomorphism for generic with array in type parameter
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 3k
- Forks
- 386
- Avg merge
- 1h 43m
- Merged PRs (30d)
- 1
Description
struct Foo<T> {
inner: T
}
#[no_mangle]
pub extern "C" fn foo_array -> Foo<[u8;32]> {
todo!()
}
will generate types like:
typedef struct Foo__________u8__________32 {
uint8_t[32]
} Foo__________u8__________32;
Why so many underscores? I'm tempted to use rename_item and rename all these to have a single underscore. but leads me to wonder if this is intentional and needed for some reason?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the Rust Foo and foo_array example, then inspect the generated C type name and compare it with the expected naming behavior. Determine whether the repeated underscores are intentional or a naming defect; done means the behavior is explained and, if needed, covered by a focused regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100