Skip to content

Commit 8b46113

Browse files
committed
feat: upgrade zerocopy to 0.8
Signed-off-by: Martin Kröning <[email protected]>
1 parent ebc29bc commit 8b46113

6 files changed

+399
-269
lines changed

Cargo.lock

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

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ rustdoc-args = ["--cfg", "docsrs"]
1515

1616
[dependencies]
1717
num_enum = { version = "0.7", default-features = false, optional = true }
18-
zerocopy = { version = "0.7", default-features = false, optional = true }
19-
zerocopy-derive = { version = "0.7", optional = true }
18+
zerocopy = { version = "0.8", default-features = false, optional = true }
19+
zerocopy-derive = { version = "0.8", optional = true }
2020

2121
[features]
2222
default = []

bindgen.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ gen() {
1212
--with-derive-partialeq \
1313
--with-derive-eq \
1414
--with-attribute-custom-enum '.*=#[cfg_attr(feature = "num_enum", derive(num_enum::IntoPrimitive,num_enum::TryFromPrimitive,num_enum::UnsafeFromPrimitive,))]' \
15-
--with-attribute-custom-struct '.*=#[cfg_attr(feature = "zerocopy", derive(zerocopy_derive::FromZeroes,zerocopy_derive::FromBytes,zerocopy_derive::AsBytes,))]' \
15+
--with-attribute-custom-struct '.*=#[cfg_attr(feature = "zerocopy", derive(zerocopy_derive::KnownLayout,zerocopy_derive::Immutable,zerocopy_derive::FromBytes,zerocopy_derive::IntoBytes,))]' \
1616
"$@"
1717
}
1818

patches/0001-fix-add-zerocopy-support-for-__IncompleteArrayField.patch

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
diff --git a/src/linux.rs b/src/linux.rs
22
--- a/src/linux.rs
33
+++ b/src/linux.rs
4-
@@ -1,7 +1,15 @@
4+
@@ -1,7 +1,16 @@
55
/* automatically generated by rust-bindgen 0.70.1 */
66

77
-#[repr(C)]
@@ -10,9 +10,10 @@ diff --git a/src/linux.rs b/src/linux.rs
1010
+#[cfg_attr(
1111
+ feature = "zerocopy",
1212
+ derive(
13-
+ zerocopy_derive::FromZeroes,
13+
+ zerocopy_derive::KnownLayout,
14+
+ zerocopy_derive::Immutable,
1415
+ zerocopy_derive::FromBytes,
15-
+ zerocopy_derive::AsBytes,
16+
+ zerocopy_derive::IntoBytes,
1617
+ )
1718
+)]
1819
pub struct __IncompleteArrayField<T>(::core::marker::PhantomData<T>, [T; 0]);
@@ -21,7 +22,7 @@ diff --git a/src/linux.rs b/src/linux.rs
2122
diff --git a/src/macos.rs b/src/macos.rs
2223
--- a/src/macos.rs
2324
+++ b/src/macos.rs
24-
@@ -1,7 +1,15 @@
25+
@@ -1,7 +1,16 @@
2526
/* automatically generated by rust-bindgen 0.70.1 */
2627

2728
-#[repr(C)]
@@ -30,9 +31,10 @@ diff --git a/src/macos.rs b/src/macos.rs
3031
+#[cfg_attr(
3132
+ feature = "zerocopy",
3233
+ derive(
33-
+ zerocopy_derive::FromZeroes,
34+
+ zerocopy_derive::KnownLayout,
35+
+ zerocopy_derive::Immutable,
3436
+ zerocopy_derive::FromBytes,
35-
+ zerocopy_derive::AsBytes,
37+
+ zerocopy_derive::IntoBytes,
3638
+ )
3739
+)]
3840
pub struct __IncompleteArrayField<T>(::core::marker::PhantomData<T>, [T; 0]);

0 commit comments

Comments
 (0)