rust-lang / rust-lang/rust-bindgen

Support case-insensitive regex patterns

Open
#3,289 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

Builder methods allowlist_* and blocklist_* do not support case-insensitive regex patterns like ((?i).*foo) (note the (?i) modifier).

If you try to use them:

let bindings = bindgen::Builder::default()
        .header("myheader.h")
        .allowlist_file("(?i).*foo") // case-insensitive regex
        .generate()

you get errors like this:

regex parse error:
    ^((?i).*foo)$
            ^
error: Unicode-aware case insensitivity matching is not available (make sure the unicode-case feature is enabled)

As the error states, the unicode-case feature of the regex crate is required for such patterns. Unfortunately bindgen neither enables this feature nor expose a way to enable it.

A possible work around is for the user to to take a direct dependency on regex and configure the feature themselves. That works but is awkard. Ideally bindgen should provide native support.

To my knowledge this limitation is also not documented anywhere.

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 at the Builder allowlist_* and blocklist_* methods and trace how their regex patterns are constructed and how the regex crate features are configured. Check existing tests or documentation covering these methods. Done means case-insensitive patterns such as (?i).*foo work and the limitation or supported behavior is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.