1 // Test for #56254, we previously allowed the last example on the 2018
2 // edition. Make sure that we now emit a warning in that case and an error for
5 //ignore-compare-mode-nll
6 //ignore-compare-mode-polonius
8 //revisions: migrate2015 migrate2018 nll2015 nll2018
10 //[migrate2018] edition:2018
11 //[nll2018] edition:2018
13 #![cfg_attr(any(nll2015, nll2018), feature(nll))]
15 fn double_conflicts() {
16 let mut v = vec![0, 1, 2];
20 //[migrate2015]~^ ERROR cannot borrow `v` as mutable
21 //[nll2015]~^^ ERROR cannot borrow `v` as mutable
22 //[migrate2018]~^^^ ERROR cannot borrow `v` as mutable
23 //[nll2018]~^^^^ ERROR cannot borrow `v` as mutable
26 fn activation_conflict() {
27 let mut v = vec![0, 1, 2];
30 //[migrate2015]~^ ERROR cannot borrow `v` as mutable
31 //[nll2015]~^^ ERROR cannot borrow `v` as mutable
32 //[migrate2018]~^^^ ERROR cannot borrow `v` as mutable
33 //[nll2018]~^^^^ ERROR cannot borrow `v` as mutable
36 fn reservation_conflict() {
37 let mut v = vec![0, 1, 2];
41 //[nll2015]~^ ERROR cannot borrow `v` as mutable
42 //[nll2018]~^^ ERROR cannot borrow `v` as mutable
43 //[migrate2015]~^^^ WARNING cannot borrow `v` as mutable
44 //[migrate2015]~| WARNING may become a hard error in the future
46 //[migrate2018]~^^^^^^ WARNING cannot borrow `v` as mutable
47 //[migrate2018]~| WARNING may become a hard error in the future