`_Accum` globals and constants panic (`CXType_Accum` fails the var.rs Auto/Unexposed assert)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 62/100
Research direction
Reproduce the panic with the provided header and bindgen invocation, then start in bindgen/ir/var.rs around the assertion and trace the failed Item::from_ty resolution for CXType_Accum. Compare this path with the existing _Accum handling for function parameters. Done means globals and const objects no longer abort and follow one of the expected outcomes: skipping the variable or using the opaque integer fallback.
Written by the indexing model from the issue text.
Description
Input C/C++ Header
const _Accum K = 7;
extern _Accum G;
Bindgen Invocation
$ bindgen input.h -- -ffixed-point
Actual Results
bindgen aborts while parsing the variable. _Accum is ISO TR 18037 / clang -ffixed-point. libclang reports CXType_Accum. Function parameters of type _Accum already go through the opaque integer fallback (u32; see #3398). Globals and const objects do not: Item::from_ty fails, and ir/var.rs then asserts that the failed type must be CXType_Auto or CXType_Unexposed.
panicked at bindgen/ir/var.rs:312:25:
Couldn't resolve constant type, and it wasn't an nondeductible auto type or unexposed type: Type(const _Accum, kind: Accum, ...)
panic in a function that cannot unwind
thread caused non-unwinding panic. aborting.
extern short _Accum and extern unsigned _Accum abort the same way. A function-only header int take(_Accum a); does not abort.
This is the same assertion text as the old _Atomic crashes (#2882 / #2920), but the type here is CXType_Accum, not _Atomic.
Expected Results
Do not abort. Skip the variable, or use the same opaque integer fallback already used for _Accum parameters.
Environment
bindgen: 0.72.1 and 0.73.1 (rust-lang/rust-bindgen 77cbc723)
clang/libclang: Homebrew clang 21.1.8
rustc: 1.97.1
target: aarch64-apple-darwin
OS: macOS
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 846
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 11
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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.
More from rust-lang/rust-bindgen
-
--enable-cxx-namespaces panics on namespace [[deprecated]] { ("[" is not a valid Ident)Possibly taken @lwz23 claimed this 47 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
rust-lang/rust-bindgen#3485 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
rust-lang/rust-bindgen#3483 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
rust-lang/rust-bindgen#3370 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
rust-lang/rust-bindgen#3363 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
rust-lang/rust-bindgen#3540 ·
Maintainers usually reply within 1 day
All issues in rust-lang/rust-bindgen
Similar issues
-
yara-x fails to build with rsa 0.10.0: unresolved import rsa::Pkcs1v15SignPossibly taken @CfirTsabari claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 87/100
VirusTotal/yara-x#865 ·
Maintainers usually reply within 1 day
-
good first issue help wanted program
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
hffgzktbcc-blip/ounce-core#297 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
nautechsystems/nautilus_trader#5631 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
bytecodealliance/rustix#1736 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
longbridge/gpui-kit#3871 ·
Maintainers usually reply within 1 day