net feature alone fails to compile in 1.1.5: sockopt uses crate::timespec, which net does not gate in
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
- #1690 @darkhonor による — マージされずにクローズ
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 70/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- rust
- 領域
- backend, networking
調査の方向性
問題は src/lib.rs にあり、timespec モジュールがゲートされています。389-409 行目を見て cfg リストを確認してください。そのリストに 'net' を追加します。次に、失敗する機能セットで cargo check を実行して修正を確認します: --no-default-features --features std,net。また、両方のバックエンドディレクトリにある sockopt.rs ファイルをチェックして、crate::timespec を参照していることを確認してください。
索引モデルが issue の本文から書いたものです。
説明
Enabling only net (with default-features = false) fails to compile. Both backends' sockopt modules reference crate::timespec unconditionally, but mod timespec is gated on a feature list that does not include net.
This affects consumers that opt into a minimal API surface rather than taking default features. In our case a crate depends on rustix purely for socket primitives and sets default-features = false, features = ["std", "net"] deliberately, so that the fs, process, thread and event APIs are not compiled in.
The configuration built cleanly on 1.1.4 and regressed in 1.1.5.
Reproduction
[dependencies]
rustix = { version = "=1.1.5", default-features = false, features = ["std", "net"] }
$ cargo build
error[E0433]: cannot find `timespec` in `crate`
--> rustix-1.1.5/src/backend/linux_raw/net/sockopt.rs:293:39
|
293 | .unwrap_or(crate::timespec::Secs::MAX),
| ^^^^^^^^ could not find `timespec` in the crate root
|
note: found an item that was configured out
--> rustix-1.1.5/src/lib.rs:410:5
|
410 | mod timespec;
| ^^^^^^^^
error: could not compile `rustix` (lib) due to 6 previous errors
Equivalently, from a checkout of v1.1.5:
$ cargo check --no-default-features --features std,net
6 x error[E0433]: cannot find `timespec` in `crate`
$ cargo check --no-default-features --features std,net,use-libc
3 x error[E0433]: cannot find `timespec` in `crate`
The error count differs by backend because backend/linux_raw/net/sockopt.rs has six references to crate::timespec and backend/libc/net/sockopt.rs has three.
Platform / versions
- rustix 1.1.5 (1.1.4 is unaffected)
- rustc 1.98.1, x86_64-unknown-linux-gnu; also reproduced on CI for aarch64-apple-darwin
- Both backends: linux_raw (default) and libc (
use-libc) mainat 287214b889865d8e1406a0ee71cc409b6f6191c8 is the 1.1.5 release commit and carries the same gate, so the issue is present onmainas well
Cause
src/lib.rs:389-409 gates the module:
#[cfg(any(
feature = "fs",
feature = "event",
feature = "process",
feature = "runtime",
feature = "thread",
feature = "time",
...
))]
mod timespec;
net is absent from that list, while SO_RCVTIMEO / SO_SNDTIMEO handling in both backends' sockopt.rs uses crate::timespec::Timespec and crate::timespec::Secs with no corresponding cfg.
Suggested fix
Add net to the gate, since the net API genuinely needs the module:
#[cfg(any(
feature = "fs",
feature = "event",
+ feature = "net",
feature = "process",
feature = "runtime",
feature = "thread",
feature = "time",
src/timespec.rs depends only on core, crate::backend::c and crate::ffi, so this does not pull in any further feature-gated code.
With that one line applied to v1.1.5, the following all pass on rustc 1.98.1:
--no-default-features --features std,net PASS (was 6 errors)
--no-default-features --features std,net,use-libc PASS (was 3 errors)
--no-default-features --features std PASS
--no-default-features --features std,fs PASS
--no-default-features --features all-apis PASS
--no-default-features --features all-apis,use-libc PASS
Gating the sockopt timeout code instead would also compile, but it would silently drop SO_RCVTIMEO / SO_SNDTIMEO support from a net-only build, which seems worse than compiling the module.
I am happy to open a PR with the one-line change if that is the preferred fix.
- 主要言語
- Rust
- スター
- 2.1k
- フォーク
- 305
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
bytecodealliance/rustix のほかの issue
-
Wrong flag used for (set_)ipv6_multicast_hops対応中かも @RajaBabu15 が 59 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
bytecodealliance/rustix#1660 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
bytecodealliance/rustix#1635 ·
メンテナーはふだん 3 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
bytecodealliance/rustix#1068 ·
メンテナーはふだん 3 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
bytecodealliance/rustix#1700 ·
メンテナーはふだん 3 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
bytecodealliance/rustix#1698 ·
メンテナーはふだん 3 日以内に返信
bytecodealliance/rustix の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
akitaonrails/ai-memory#1225 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
acsandmann/rift#577 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
[Bug]: rerank on the huggingface provider (TEI) always costs $0, configured input_cost_per_query is ignored対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンllm translation
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信