Conversation
Both backends' `sockopt` modules reference `crate::timespec` unconditionally
for `SO_RCVTIMEO` and `SO_SNDTIMEO`, but `mod timespec` was not gated in by
`net`. Building with only `net` enabled therefore failed:
error[E0433]: cannot find `timespec` in `crate`
six times via the linux_raw backend and three via libc. This affects
consumers that set `default-features = false` and opt into a minimal API
surface rather than taking the defaults. 1.1.4 was unaffected.
`src/timespec.rs` depends only on `core`, `crate::backend::c` and
`crate::ffi`, so gating it on `net` pulls in no further feature-gated code.
Gating the `sockopt` timeout code instead would also compile, but would
silently drop `SO_RCVTIMEO` and `SO_SNDTIMEO` from a `net`-only build.
Adds `net` and `net,use-libc` to the --no-default-features CI job, matching
the existing `time` and `time,use-libc` checks, so the combination does not
regress again.
This was referenced Sep 23, 2026
Author
|
Closing as a duplicate of #1681, which makes the identical one-line change and predates this by five days. I did not find it before opening this: I searched issues rather than open pull requests, which is my error. Credit for the fix belongs to @HalFrgrd. The two |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1689.
Both backends'
sockoptmodules referencecrate::timespecunconditionally when handlingSO_RCVTIMEOandSO_SNDTIMEO, butmod timespecwas not gated in bynet. Building with onlynetenabled fails witherror[E0433]: cannot findtimespecincrate``, six times through the linux_raw backend and three through libc. 1.1.4 was unaffected.This reaches consumers that set
default-features = falseand opt into a minimal API surface rather than taking the defaults, which is the case that prompted the report.netgenuinely needs the module, so it is added to the gate rather than removing the uses.src/timespec.rsdepends only oncore,crate::backend::candcrate::ffi, so this pulls in no further feature-gated code.Gating the
sockopttimeout code instead would also compile, but would silently dropSO_RCVTIMEOandSO_SNDTIMEOsupport from anet-only build.The
--no-default-featuresjob already checkstimeandtime,use-libcindividually;netandnet,use-libcare added alongside them so the combination does not regress.Verified on rustc 1.98.1 with the job's own
RUSTFLAGS: -D warnings -D elided-lifetimes-in-paths:netnet,use-libcstd,netstd,net,use-libcstdstd,fsall-apisall-apis,use-libc