Compiler error message is unhelpful when trying `ndarray::s!([2..3])`
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 45/100
Direção de pesquisa
Start with the ndarray::s! macro and the failing call shown at src/tiler.rs:59. Reproduce the compiler diagnostic for ndarray::s!([2..3]), then inspect the macro documentation and determine whether the finished change should provide a clearer diagnostic or explain the nested-bracket mistake in the documentation.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
error[E0277]: the trait bound `[std::ops::Range<{integer}>; 1]: ndarray::SliceNextDim` is not satisfied
--> src/tiler.rs:59:25
|
59 | input.slice(ndarray::s!([2..3]));
| ^^^^^^^^^^^^^^^^^^^ the trait `ndarray::SliceNextDim` is not implemented for `[std::ops::Range<{integer}>; 1]`
|
note: required by a bound in `ndarray::SliceNextDim::next_in_dim`
I type () after function-like macro call (that is not constructing a data structure sample) almost automatically and I also remember that I need array of ranges for ndarray::s!. That has resulted in s!([...]) twice already, and I spend more than a minute looking at the code, documentation and error message.
The error message looks as if arrays or ranges are not OK for ndarray::s. It is not obvious that the mistake is not in usage of ranges or arrays, but in usage of extra outer parentheses.. Although one should not use arrays when doing ndarray:s, square brackets in documentation makes it feels as if we were specifying a Rust array as input to the macro, which may result in actual Rust array being fed to it.
Maybe the macro should detect extra brackets and output more more helpful warning or error? Or at least documentation of ndarray::s should mention possible compiler error about []: SliceNextDim and tell user to look at nested brackets?
- Linguagem predominante
- Rust
- Estrelas
- 4.3k
- Forks
- 391
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de rust-ndarray/ndarray
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
rust-ndarray/ndarray#1612 · 1 comentário ·
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
rust-ndarray/ndarray#1617 · 1 comentário ·
-
Stack overflow in `triu` Abertabug good first issue
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 68/100
rust-ndarray/ndarray#1615 · 1 comentário ·
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
rust-ndarray/ndarray#1610 ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 72/100
rust-ndarray/ndarray#1609 ·
Todas as issues de rust-ndarray/ndarray
Issues semelhantes
-
risk:low runtime status:in-progress type:test
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
zeroclaw-labs/zeroclaw#11023 ·
-
good first issue refactor
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
EricSpencer00/Resilient#4835 · 1 comentário ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
bisq-network/bisq-musig#204 ·
-
agent:ready documentation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
cesarferreira/stax#890 ·