fix(net): make udp batch cfgs match the bsd module routing for tvos/watchos

`net/sys/unix/bsd/mod.rs` already routes macos, ios, watchos and tvos
to `bsd/macos.rs`, and that module unconditionally imports
`net::udp::{BatchRecvMessage, BatchSendMessage}`. But the nine cfg
gates in `net/udp.rs` list only macos and ios among the Apple
platforms, so on watchos and tvos those items are configured out while
the importer is still compiled -- E0432, the crate does not build.

Add watchos and tvos to the nine gates so the two lists agree.
This commit is contained in:
gengjiawen
2026-08-08 23:20:32 +08:00
committed by ty
parent ec908d9244
commit db65eaa824
+18
View File
@@ -5,6 +5,8 @@
target_os = "android",
target_os = "macos",
target_os = "ios",
target_os = "watchos",
target_os = "tvos",
target_os = "freebsd"
))]
use std::io::{ErrorKind, IoSlice, IoSliceMut};
@@ -20,6 +22,8 @@ use std::{
target_os = "android",
target_os = "macos",
target_os = "ios",
target_os = "watchos",
target_os = "tvos",
target_os = "freebsd"
))]
use futures::future;
@@ -30,6 +34,8 @@ use futures::ready;
target_os = "android",
target_os = "macos",
target_os = "ios",
target_os = "watchos",
target_os = "tvos",
target_os = "freebsd"
))]
use tokio::io::Interest;
@@ -48,6 +54,8 @@ use super::{
target_os = "android",
target_os = "macos",
target_os = "ios",
target_os = "watchos",
target_os = "tvos",
target_os = "freebsd"
))]
pub struct BatchSendMessage<'a> {
@@ -65,6 +73,8 @@ pub struct BatchSendMessage<'a> {
target_os = "android",
target_os = "macos",
target_os = "ios",
target_os = "watchos",
target_os = "tvos",
target_os = "freebsd"
))]
pub struct BatchRecvMessage<'a> {
@@ -298,6 +308,8 @@ impl UdpSocket {
target_os = "android",
target_os = "macos",
target_os = "ios",
target_os = "watchos",
target_os = "tvos",
target_os = "freebsd"
))]
pub fn poll_batch_send(
@@ -327,6 +339,8 @@ impl UdpSocket {
target_os = "android",
target_os = "macos",
target_os = "ios",
target_os = "watchos",
target_os = "tvos",
target_os = "freebsd"
))]
pub async fn batch_send(&self, msgs: &mut [BatchSendMessage<'_>]) -> io::Result<usize> {
@@ -339,6 +353,8 @@ impl UdpSocket {
target_os = "android",
target_os = "ios",
target_os = "macos",
target_os = "watchos",
target_os = "tvos",
target_os = "freebsd"
))]
pub fn poll_batch_recv(
@@ -368,6 +384,8 @@ impl UdpSocket {
target_os = "android",
target_os = "macos",
target_os = "ios",
target_os = "watchos",
target_os = "tvos",
target_os = "freebsd"
))]
pub async fn batch_recv(&self, msgs: &mut [BatchRecvMessage<'_>]) -> io::Result<usize> {