]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/index-mut-help.rs
Auto merge of #98051 - davidtwco:split-dwarf-stabilization, r=wesleywiser
[rust.git] / src / test / 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
4
5 fn main() {
6     use std::collections::HashMap;
7
8     let mut map = HashMap::new();
9     map.insert("peter", "23".to_string());
10
11     map["peter"].clear();           //~ ERROR
12     map["peter"] = "0".to_string(); //~ ERROR
13     let _ = &mut map["peter"];      //~ ERROR
14 }