rust-lang / rust-lang/rust-bindgen

Over enforced naming in shared library name?

Open
#3,209 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

While using bindgen against a library with a name such as '-1.0.0', bindgen generates " is not a valid Ident". This seems overly restrictive given that many libraries use such conventions. Renaming to '_1.0.0' also produces the same issue as '.' is not allowed in the name. Bindgen seems to be forcing a validation of the name against Rust "Ident" which is severely limiting when used against common library naming practices. I would expect that the name of the shared library should allow arbitrary conventions without this limit as the generated code does not seem to reference the name in any notable manner, at least with the settings I'm using.

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 by reproducing the issue with bindgen against a shared library named '-1.0.0' and '_1.0.0', then trace where the library name is validated as a Rust identifier. Done means conventional shared-library names no longer trigger the invalid-identifier error when they are not used as generated Rust identifiers; add a regression test for these names.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.