diff options
Diffstat (limited to 'tests/ui/suggestions/suggest-split-at-mut.rs')
-rw-r--r-- | tests/ui/suggestions/suggest-split-at-mut.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/ui/suggestions/suggest-split-at-mut.rs b/tests/ui/suggestions/suggest-split-at-mut.rs new file mode 100644 index 000000000..d294c20b8 --- /dev/null +++ b/tests/ui/suggestions/suggest-split-at-mut.rs @@ -0,0 +1,8 @@ +fn main() { + let mut foo = [1, 2, 3, 4]; + let a = &mut foo[2]; + let b = &mut foo[3]; //~ ERROR cannot borrow `foo[_]` as mutable more than once at a time + *a = 5; + *b = 6; + println!("{:?} {:?}", a, b); +} |