rust-lang / rust-lang/rust-bindgen

Blacklisting functions/items doesn't seem to work with Blocks

Open
#1,707 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Quite related to https://github.com/rust-lang/rust-bindgen/issues/1706

I've tried a number of things and this doesn't seem to fix or remove the generated block type alias.

Input C/C++ Header
// bindgen-flags:  --blacklist-function enumerateObjectsUsingBlock  --blacklist-type FooWithBlock* --generate-block --objc-extern-crate --block-extern-crate  -- -x objective-c -fblocks
// bindgen-osx-only

@interface FooWithBlock<__covariant ObjectType>
- (void)enumerateObjectsUsingBlock:(void (^)(ObjectType obj, int idx))block;
@end

Bindgen Invocation
$ bindgen input.h --blacklist-function enumerateObjectsUsingBlock  --blacklist-type FooWithBlock* --generate-block --objc-extern-crate --block-extern-crate  -- -x objective-c -fblocks
Actual Results
/* automatically generated by rust-bindgen */

pub type _bindgen_ty_id_5 =
    *const ::block::Block<(*mut ObjectType, ::std::os::raw::c_int), ()>;
Expected Results

Nothing I would think.

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 bindgen invocation in the issue with the Objective-C header and block-related flags. Trace how blacklist-function and blacklist-type are applied to generated block aliases; done means the reported _bindgen_ty_id_5 alias is absent from the generated bindings.

Written by the indexing model from the issue text.

Assessment

Tech stack
objective-c, rust
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.