]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/index-mut-help.rs
Rollup merge of #106644 - alexcrichton:update-wasi-toolchain, r=cuviper
[rust.git] / tests / ui / borrowck / index-mut-help.rs
1 // When mutably indexing a type that implements `Index` but not `IndexMut`, a
2 // special 'help' message is added to the output.
3 use std::collections::HashMap;
4
5
6 fn main() {
7     let mut map = HashMap::new();
8     map.insert("peter", "23".to_string());
9
10     map["peter"].clear();           //~ ERROR
11     map["peter"] = "0".to_string(); //~ ERROR
12     let _ = &mut map["peter"];      //~ ERROR
13 }