Semver question: Is the non-qualified call to `.as_dyn_error()` intentional?
まだ誰も着手していません。
評価
調査の方向性
impl/src/expand.rs の生成された .as_dyn_error() 呼び出しの周辺と、src/aserror.rs の非公開の AsDynError trait を読みます。issue に記載されたメソッド解決の挙動を再現し、その後、外部メソッドがサポートされているかを判断します。この契約を文書化するか、完全修飾呼び出しを採用するかを決定し、互換性への影響に対処できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Right now the thiserror macro will generate code that invokes the hidden AsDynError trait. However it doesn't use a fully qualified path, but instead uses method-call resolution, where an inherent method on the field type shadows the trait method.
Is this an intentional choice to allow external implementations of the method?
Context: In rootcause we got a feature request to support placing a rootcause report inside enums with thiserror impls using #[error(transparent)].
While we don't recommend this way of combining thiserror and rootcause, we do consider it a helpful feature to make migrations of large codebases easier.
We added the feature using a Deref impl, but we had to roll back the change.
However after rolling back the change, I noticed that the #[error(transparent)] code still worked. It turns out, this is because we also named our method .as_dyn_error(), so everything happened to still work.
This makes me a bit worried, as "internal" changes in thiserror can now cause accidental breakage in consumers that use both thiserror and rootcause.
It'd be good to know where you land on this. If external as_dyn_error() impls are fair game, then we will document that this is a supported (but non-recommended) way to combine rootcause with thiserror. Otherwise we'd rather you make the call fully-qualified so the behavior breaks now instead of by accident later.
- 主要言語
- Rust
- スター
- 5.6k
- フォーク
- 220
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dtolnay/thiserror のほかの issue
-
Improve #[from] documentation example.対応中かも @SatvikMishra08 が 50 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
No `unused field` warnings are produced on enums deriving thiserror::Error対応中かも @usmanovbf が 240 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
-
example from documentation does not compile再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
dtolnay/thiserror の issue をすべて見る
似ている issue
-
Selected chart highlights only its values, not its series names and category labels対応中かも @Higgs32584 が今日担当しました。 オープンbug priority: low ui
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
storytold/gridcraft#4390 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
bug bugfix priority: medium
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
quarto-dev/q2#1219 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100