Repository navigation
fix(bsd): make sockaddr_in zero fill portable to unsigned c_char targets - #49
Conversation
The bindgen-generated BSD bindings declare sockaddr_in::sin_zero as
[c_char; 8], and c_char is u8 on aarch64, powerpc64, powerpc64le and
riscv64 (it is i8 only on x86 and on Apple arm64). The literal
`[0i8; 8]` in `From<Ipv4Addr> for sockaddr_in` therefore fails to type
check on every non-x86 BSD target:
error[E0308]: mismatched types
--> src/unix_bsd/mod.rs:630:24
|
630 | sin_zero: [0i8; 8],
| ^^^ expected `u8`, found `i8`
Let the element type be inferred from the field instead.
Seen building rayfish 0.5.3 on FreeBSD 15.1 powerpc64le with rustc 1.98.1.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe IPv4 socket-address conversion now initializes ChangesIPv4 Socket Address
Priority: ➖ Normal Estimated code review effort: 1 (Trivial) | ~3 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to This change preserves the zero-filled socket-address field while allowing its element type to match the platform binding. No merge-blocking risk is identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
The bindgen-generated BSD bindings declare sockaddr_in::sin_zero as
[c_char; 8], and c_char is u8 on aarch64, powerpc64, powerpc64le and
riscv64 (it is i8 only on x86 and on Apple arm64). The literal
[0i8; 8]inFrom<Ipv4Addr> for sockaddr_intherefore fails to typecheck on every non-x86 BSD target:
Let the element type be inferred from the field instead.
Seen building rayfish 0.5.3 on FreeBSD 15.1 powerpc64le with rustc 1.98.1.
Summary by CodeRabbit