Adding rsa dependency introduces non-additive lazy_static feature that breaks other code
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- rust
調査の方向性
Start by tracing the rsa to num-bigint-dig to lazy_static dependency chain and reproducing the failure with a non-Send lazy_static value like the example in image.rs. Determine how the non-additive spin_no_std feature is enabled and whether the dependency declarations expose a way to avoid it. Done means the rsa dependency no longer breaks unrelated workspace code and the regression is covered by a reproducible check.
索引モデルが issue の本文から書いたものです。
説明
This is the same problem as #219, but since that issue wasn't fully evaluated, I wanted to add my report, with a bit more context.
Dependency chain:
rsadepends onnum-bigint-dignum-bigint-digdepends onlazy_staticwithfeatures = ["spin_no_std"].
lazy_static's spin_no_std feature is non-additive; it causes lazy_static to replace use of std::sync::Once with spin:once::Once. This may seem like a harmless replacement, but:
spin::once::Once<T>has different trait bounds. Namely, it only implementsSyncwhereT: Send + Syncwhilelazy_staticusingstd::sync::Onceonly requiresT: Sync.- This means that anyone using
lazy_staticon a non-Sendtype will see their code break if thespin_no_stdfeature is enabled. - Adding
rsaas a dependency to a large workspace means that every crate in that workspace now gets the modifiedlazy_staticcode usingspinwith stricter trait bounds.
This is currently happening to me: I added rsa to a large workspace, and that change causes compile errors in unrelated (previously working) code:
error[E0277]: `*const u8` cannot be sent between threads safely
--> image.rs:25:1
|
25 | / lazy_static::lazy_static! {
26 | | pub(crate) static ref HELLO_IMAGE: Option<ImageBuffer> = {
27 | | let image_bytes = std::fs::read("hello.png").ok()?;
28 | |
... |
36 | | };
37 | | }
| |_^ `*const u8` cannot be sent between threads safely
I'm not sure how to handle this, but it would be nice if there were a feature in rsa (and num-bigint-dig) to disable this behavior. As it is, I'm unable to add an rsa dependency unless I fork+patch num-bigint-dig.
- 主要言語
- Rust
- スター
- 673
- フォーク
- 190
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
RustCrypto/RSA のほかの issue
-
Bump MSRV to 1.89 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
RustCrypto/RSA#707 · コメント 2 件 · リアクション 1 件 ·
-
難易度 3/5 半日 初心者へのやさしさ 74/100
RustCrypto/RSA#703 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
RustCrypto/RSA#686 · コメント 4 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
RustCrypto/RSA#647 · コメント 9 件 · リアクション 1 件 ·
-
broken rust docs オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
RustCrypto/RSA#641 · リアクション 3 件 ·
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
TheLarkInn/aipm#2413 ·
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
alexgorbatchev/simple-ptt#15 ·
-
tooling
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
todo:ticket
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
taikoxyz/taiko-mono#22168 · コメント 1 件 ·