]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/two-phase-reservation-sharing-interference-2.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / two-phase-reservation-sharing-interference-2.rs
1 // Test for #56254. The last example originally failed with the ast checker, was
2 // accidentally allowed under migrate/nll, then linted against in migrate mode
3 // but disallowed under NLL. Now, we accept it everywhere.
4
5 //ignore-compare-mode-polonius
6
7 fn double_conflicts() {
8     let mut v = vec![0, 1, 2];
9     let shared = &v;
10
11     v.extend(shared);
12     //~^ ERROR cannot borrow `v` as mutable
13 }
14
15 fn activation_conflict() {
16     let mut v = vec![0, 1, 2];
17
18     v.extend(&v);
19     //~^ ERROR cannot borrow `v` as mutable
20 }
21
22 fn reservation_allowed() {
23     let mut v = vec![0, 1, 2];
24     let shared = &v;
25
26     v.push(shared.len());
27 }
28
29 fn main() {}