]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/index-mut-help.rs
Add 'src/tools/miri/' from commit '75dd959a3a40eb5b4574f8d2e23aa6efbeb33573'
[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 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 }