Skip to content

Commit 1abd864

Browse files
committed
Do not derive Default on vtable types
#597 (comment)
1 parent cc6f3b2 commit 1abd864

8 files changed

+1
-13
lines changed

src/codegen/mod.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -706,11 +706,7 @@ impl<'a> CodeGenerator for Vtable<'a> {
706706
assert_eq!(item.id(), self.item_id);
707707
// For now, generate an empty struct, later we should generate function
708708
// pointers and whatnot.
709-
let mut attributes = vec![attributes::repr("C")];
710-
711-
if ctx.options().derive_default {
712-
attributes.push(attributes::derives(&["Default"]))
713-
}
709+
let attributes = vec![attributes::repr("C")];
714710

715711
let vtable = aster::AstBuilder::new()
716712
.item()

tests/expectations/tests/enum_and_vtable_mangling.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ pub const whatever_else: _bindgen_ty_1 = _bindgen_ty_1::whatever_else;
1010
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1111
pub enum _bindgen_ty_1 { match_ = 0, whatever_else = 1, }
1212
#[repr(C)]
13-
#[derive(Default)]
1413
pub struct C__bindgen_vtable {
1514
}
1615
#[repr(C)]

tests/expectations/tests/nested_vtable.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66

77
#[repr(C)]
8-
#[derive(Default)]
98
pub struct nsISupports__bindgen_vtable {
109
}
1110
#[repr(C)]

tests/expectations/tests/ref_argument_array.rs

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
pub const NSID_LENGTH: ::std::os::raw::c_uint = 10;
88
#[repr(C)]
9-
#[derive(Default)]
109
pub struct nsID__bindgen_vtable {
1110
}
1211
#[repr(C)]

tests/expectations/tests/virtual_dtor.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66

77
#[repr(C)]
8-
#[derive(Default)]
98
pub struct nsSlots__bindgen_vtable {
109
}
1110
#[repr(C)]

tests/expectations/tests/virtual_inheritance.rs

-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ impl Clone for A {
2525
fn clone(&self) -> Self { *self }
2626
}
2727
#[repr(C)]
28-
#[derive(Default)]
2928
pub struct B__bindgen_vtable {
3029
}
3130
#[repr(C)]
@@ -53,7 +52,6 @@ impl Default for B {
5352
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
5453
}
5554
#[repr(C)]
56-
#[derive(Default)]
5755
pub struct C__bindgen_vtable {
5856
}
5957
#[repr(C)]

tests/expectations/tests/virtual_overloaded.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66

77
#[repr(C)]
8-
#[derive(Default)]
98
pub struct C__bindgen_vtable {
109
}
1110
#[repr(C)]

tests/expectations/tests/vtable_recursive_sig.rs

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ impl Default for Derived {
2323
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
2424
}
2525
#[repr(C)]
26-
#[derive(Default)]
2726
pub struct Base__bindgen_vtable {
2827
}
2928
#[repr(C)]

0 commit comments

Comments
 (0)