failed Send inference with ndarray v0.17 and uom 0.38
まだ誰も着手していません。
評価
調査の方向性
Reproduce the minimal example in src/main.rs with Rust 1.98.1, uom 0.38, and ndarray 0.17.2, then compare the result with ndarray 0.16. Read the reported rust-lang/rust issue #162558 alongside ndarray's async and Send-related behavior; done means identifying whether the regression belongs to ndarray or rustc and documenting or fixing the confirmed cause.
索引モデルが issue の本文から書いたものです。
説明
I'm running into a compile error using an Array2uom::si::f64::Length from inside an async function.
Please note this did work with ndarray v0.16.
- rust 1.98.1
- uom v0.38
- ndarray v0.17.2 (NOTE - v0.16 seems to work)
The problem can be isolated into the following minimal example, which I would expect to compile:
use uom::si::f64::Length;
use uom::ConstZero;
use ndarray::Array2;
fn assert_send<T: Send>(_t: T) {}
fn main() {
assert_send(check());
}
async fn check() {
let lengths: Array2<Length> = Array2::from_elem((2, 3), Length::ZERO);
std::future::pending::<()>().await;
println!("{}", lengths[(0, 0)].get::<uom::si::length::meter>());
}
This produces the following compiler error message:
error[E0308]: mismatched types
--> src/main.rs:8:5
|
8 | assert_send(check());
| ^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
= note: expected struct `Quantity<..., ..., f64>`
found struct `Quantity<..., ..., f64>`
note: the lifetime requirement is introduced here
--> src/main.rs:5:19
|
5 | fn assert_send<T: Send>(_t: T) {}
| ^^^^
Since it is not clear to me if the problem is on the ndarray or the rustc side I also reported it to rust-lang/rust (#162558).
I have a workaround wrapping the Array2 into a newtype with a at(&self,usize,usize)->Length fn and using that to obtain Length quantities inside the async fn. This comes from a bigger project though (https://github.com/ODIN-fire/odin-rs) where such workarounds are clearly suboptimal since it is highly async.
- 主要言語
- Rust
- スター
- 4.3k
- フォーク
- 391
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rust-ndarray/ndarray のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
rust-ndarray/ndarray#1612 · コメント 1 件 ·
-
bug good first issue
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
rust-ndarray/ndarray#1615 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
rust-ndarray/ndarray#1610 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
rust-ndarray/ndarray#1609 ·
-
breaking-change enhancement
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
rust-ndarray/ndarray#1591 · コメント 2 件 ·
rust-ndarray/ndarray の issue をすべて見る
似ている issue
-
risk:low runtime status:in-progress type:test
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
zeroclaw-labs/zeroclaw#11023 ·
-
good first issue refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
EricSpencer00/Resilient#4835 · コメント 1 件 ·
-
agent:ready documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
cesarferreira/stax#890 ·
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 90/100