Hello everyone. I practice using vectors. I wanted to iterate over mutable references to each element of the mutable vector in order to make changes to all elements. But somehow I got an error. I'm a beginner and would appreciate everyone's help!
My code:
fn main() {
let mut s = vec![10, 20, 30];
for i in &mut s {
*i += 10;
println!("{}", i);
}
}
Error: could not compile storing_lists_vectors
Additional info:
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.55.0 (c8dfcfe04 2021-09-06) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack