Skip to content

Commit c196db6

Browse files
committed
Prevent default derives for Forward declared types.
We do not know the layout for forward declared types. Deriving Copy, Clone, Hash, PartialEq etc. is simply wrong. Deriving Debug is debatable. The default derive might give a wrong impression, since it prints out the inner unused field. The opt-in manual implementation would print opaque, which seems friendlier. Changed tests: - func-return-must-use: Don't use forward declared structs in the test, since that would result in wrong bindings! - issue-1238-fwd-no-copy test no longer requires an annotation, since Forward declared types should always be no copy
1 parent 03d49b6 commit c196db6

21 files changed

+41
-37
lines changed

bindgen-tests/tests/expectations/tests/anon_union.rs

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/forward-declaration-autoptr.rs

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/forward_declared_complex_types.rs

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/forward_declared_opaque.rs

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/func_return_must_use.rs

Lines changed: 24 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/issue-1238-fwd-no-copy.rs

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/issue-1443.rs

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/issue-654-struct-fn-collision.rs

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/issue-710-must-use-type.rs

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/issue-801-opaque-sloppiness.rs

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)