Skip to content

Commit 95d8d58

Browse files
committed
For compatibility, just keep deriving Default for all opaque types
1 parent 9d58571 commit 95d8d58

File tree

8 files changed

+8
-57
lines changed

8 files changed

+8
-57
lines changed

bindgen-tests/tests/expectations/tests/libclang-9/issue-544-stylo-creduce-2.rs

+1-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/non-type-params.rs

+1-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/nsBaseHashtable.rs

+1-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/partial-specialization-and-inheritance.rs

+1-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/size_t_template.rs

+1-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/va_list_aarch64_linux.rs

+1-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen/codegen/mod.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -5448,16 +5448,9 @@ pub(crate) mod utils {
54485448
let ty = quote! {
54495449
/// If Bindgen could only determine the size and alignment of a
54505450
/// type, it is represented like this.
5451-
#[derive(PartialEq, Copy, Clone, Hash, Debug)]
5451+
#[derive(PartialEq, Copy, Clone, Debug, Default, Hash)]
54525452
#[repr(C)]
54535453
pub struct __BindgenOpaqueArray<T, const N: usize>(pub [T; N]);
5454-
/// `Default` is only implemented for zero-sized opaque types, since
5455-
/// Bindgen does not know what contents make sense as a default.
5456-
impl<T> Default for __BindgenOpaqueArray<T, 0> {
5457-
fn default() -> Self {
5458-
Self([])
5459-
}
5460-
}
54615454
};
54625455

54635456
result.insert(0, ty);

bindgen/ir/ty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ pub(crate) enum TypeKind {
582582
/// A compound type, that is, a class, struct, or union.
583583
Comp(CompInfo),
584584

585-
/// An opaque type that we just don't understand. All usage of this shoulf
585+
/// An opaque type that we just don't understand. All usage of this should
586586
/// result in an opaque blob of bytes generated from the containing type's
587587
/// layout.
588588
Opaque,

0 commit comments

Comments
 (0)