Skip to content

Commit 930a6ac

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, since it can't print anything useful. Since we previously would derive Debug, lets just keep it, to avoid needless breaking changes. 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 - forward-declaration-autoptr.rs: Manually implement clone. The inner type is unknown, so requiring clone/copy is not correct.
1 parent 03d49b6 commit 930a6ac

20 files changed

+80
-38
lines changed

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

Lines changed: 2 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: 14 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_complex_types.rs

Lines changed: 3 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: 2 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-1443.rs

Lines changed: 1 addition & 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: 1 addition & 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: 3 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: 1 addition & 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/layout_array.rs

Lines changed: 1 addition & 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)