rust-bindgen icon indicating copy to clipboard operation
rust-bindgen copied to clipboard

Is it always necessary to put every function definition in a separate extern block?

Open crumblingstatue opened this issue 7 years ago • 5 comments

Here is a diff of regenerating some bindings with servo/rust-bindgen over the old Yamakaky/rust-bindgen: https://github.com/jeremyletang/rust-sfml/commit/ed4ecd7d48d756bf2d51d85f928c3c736c780625#diff-1e7d161ae38b44ab3fb4c32f7c2bdf19R371

It adds a lot of extra noise with all those extern blocks.

crumblingstatue avatar Mar 07 '17 10:03 crumblingstatue

So this is done this way because after the rewrite, each parsed item is conceptually independent and can generate a rust ast::Item. The way to do this for functions is generating an extern block.

I don't think coalescing them is a priority, but I'd be happy to take a patch that does it as long as it's not a maintenance burden.

emilio avatar Mar 07 '17 11:03 emilio

This should IMO be a top priority to fix.

nox avatar Mar 17 '17 08:03 nox

I've read lots of reports from users on IRC and that was their main complaint about it.

nox avatar Mar 17 '17 08:03 nox

This should IMO be a top priority to fix.

Its purely aesthetics of machine generated code that people aren't maintaining by hand... That doesn't scream "top priority" to me, but patches are ofc very welcome.

fitzgen avatar Mar 17 '17 16:03 fitzgen

Its purely aesthetics of machine generated code that people aren't maintaining by hand...

Aesthetics matter, and changes to generated bindings are more confusing to review with all the noise.

nox avatar Mar 17 '17 17:03 nox