rust/tests/ui/suggestions/suggest-mut-method-for-loop.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
322 B
Rust
Raw Normal View History

2021-01-28 03:14:35 -06:00
use std::collections::HashMap;
struct X(usize);
struct Y {
v: u32
}
fn main() {
let mut buzz = HashMap::new();
buzz.insert("a", Y { v: 0 });
for mut t in buzz.values() {
//~^ HELP
//~| SUGGESTION values_mut()
t.v += 1;
//~^ ERROR cannot assign
}
}