for index for indices loop example issue
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- rust
- Domain
- documentation
Research direction
Start by reproducing the for_idx.rs snippet with the Rust version and compiler output reported in the issue. Review the intended index-loop example and its formatting, then update the example so it matches the supported Rust behavior and compiles without the reported errors.
Written by the indexing model from the issue text.
Description
working with for .. index loop example.
$ rustc --version
rustc 1.12.0-nightly (9316ae515 2016-07-24)
$
fn print_all( all: Vec ){
for i in ..all.len() {
println!("{}: {}", i, all.get(i));
}
}
fn main() {
}
`
the compiler error seen is
for_idx.rs:4:2: 6:3 error: the trait bound std::ops::RangeTo<usize>: std::iter::Iterator is not satisfied [E0277]
for_idx.rs:4 for i in ..all.len() {
^
for_idx.rs:4:2: 6:3 help: run rustc --explain E0277 to see a detailed explanation
for_idx.rs:4:2: 6:3 note: std::ops::RangeTo<usize> is not an iterator; maybe try calling .iter() or a similar method
for_idx.rs:4:2: 6:3 note: required by std::iter::IntoIterator::into_iter
for_idx.rs:5:25: 5:35 error: the trait bound std::option::Option<&i32>: std::fmt::Display is not satisfied [E0277]
for_idx.rs:5 println!("{}: {}", i, all.get(i));
^~~~~~~~~~
:2:27: 2:58 note: in this expansion of format_args!
:3:1: 3:54 note: in this expansion of print! (defined in )
for_idx.rs:5:3: 5:37 note: in this expansion of println! (defined in )
for_idx.rs:5:25: 5:35 help: run rustc --explain E0277 to see a detailed explanation
for_idx.rs:5:25: 5:35 note: std::option::Option<&i32> cannot be formatted with the default formatter; try using :? instead if you are using a format string
for_idx.rs:5:25: 5:35 note: required by std::fmt::Display::fmt
error: aborting due to 2 previous errors
- Dominant language
- Rust
- Stars
- 3.9k
- Forks
- 297
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nrc/r4cppp
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
-
Difficulty 1/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 38/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 42/100
Similar issues
-
Browser (wasm) relay client cannot connect to relays whose URL has a trailing-dot FQDN hostname Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
n0-computer/iroh#4550 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
paritytech/zombienet-sdk#591 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
farion1231/cc-switch#7638 · 1 comment ·
-
onnx-ir re-exports ModelProto and GraphProto but not NodeProto, AttributeProto and AttributeType Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100