Skip to content

Commit

Permalink
For compatibility, just keep deriving Default for all opaque types
Browse files Browse the repository at this point in the history
  • Loading branch information
GKFX committed Aug 9, 2024
1 parent 9d58571 commit 95d8d58
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 57 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions bindgen-tests/tests/expectations/tests/non-type-params.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions bindgen-tests/tests/expectations/tests/nsBaseHashtable.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions bindgen-tests/tests/expectations/tests/size_t_template.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions bindgen/codegen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5448,16 +5448,9 @@ pub(crate) mod utils {
let ty = quote! {
/// If Bindgen could only determine the size and alignment of a
/// type, it is represented like this.
#[derive(PartialEq, Copy, Clone, Hash, Debug)]
#[derive(PartialEq, Copy, Clone, Debug, Default, Hash)]
#[repr(C)]
pub struct __BindgenOpaqueArray<T, const N: usize>(pub [T; N]);
/// `Default` is only implemented for zero-sized opaque types, since
/// Bindgen does not know what contents make sense as a default.
impl<T> Default for __BindgenOpaqueArray<T, 0> {
fn default() -> Self {
Self([])
}
}
};

result.insert(0, ty);
Expand Down
2 changes: 1 addition & 1 deletion bindgen/ir/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ pub(crate) enum TypeKind {
/// A compound type, that is, a class, struct, or union.
Comp(CompInfo),

/// An opaque type that we just don't understand. All usage of this shoulf
/// An opaque type that we just don't understand. All usage of this should
/// result in an opaque blob of bytes generated from the containing type's
/// layout.
Opaque,
Expand Down

0 comments on commit 95d8d58

Please sign in to comment.