2019-03-01 20:09:54 +00:00
|
|
|
// Test for #56254, we previously allowed the last example on the 2018
|
2019-04-22 07:40:08 +00:00
|
|
|
// edition. Make sure that we now emit a warning in that case and an error for
|
2019-03-01 20:09:54 +00:00
|
|
|
// everyone else.
|
|
|
|
|
|
|
|
//ignore-compare-mode-nll
|
|
|
|
|
2019-04-22 07:40:08 +00:00
|
|
|
//revisions: migrate2015 migrate2018 nll2015 nll2018
|
2019-03-01 20:09:54 +00:00
|
|
|
|
|
|
|
//[migrate2018] edition:2018
|
|
|
|
//[nll2018] edition:2018
|
|
|
|
|
|
|
|
#![cfg_attr(any(nll2015, nll2018), feature(nll))]
|
|
|
|
|
|
|
|
fn double_conflicts() {
|
2017-12-06 11:25:36 +00:00
|
|
|
let mut v = vec![0, 1, 2];
|
|
|
|
let shared = &v;
|
|
|
|
|
2019-03-01 20:09:54 +00:00
|
|
|
v.extend(shared);
|
|
|
|
//[migrate2015]~^ ERROR cannot borrow `v` as mutable
|
|
|
|
//[nll2015]~^^ ERROR cannot borrow `v` as mutable
|
|
|
|
//[migrate2018]~^^^ ERROR cannot borrow `v` as mutable
|
|
|
|
//[nll2018]~^^^^ ERROR cannot borrow `v` as mutable
|
|
|
|
}
|
|
|
|
|
|
|
|
fn activation_conflict() {
|
|
|
|
let mut v = vec![0, 1, 2];
|
|
|
|
|
|
|
|
v.extend(&v);
|
|
|
|
//[migrate2015]~^ ERROR cannot borrow `v` as mutable
|
|
|
|
//[nll2015]~^^ ERROR cannot borrow `v` as mutable
|
|
|
|
//[migrate2018]~^^^ ERROR cannot borrow `v` as mutable
|
|
|
|
//[nll2018]~^^^^ ERROR cannot borrow `v` as mutable
|
|
|
|
}
|
|
|
|
|
|
|
|
fn reservation_conflict() {
|
|
|
|
let mut v = vec![0, 1, 2];
|
|
|
|
let shared = &v;
|
2017-12-06 11:25:36 +00:00
|
|
|
|
2019-03-01 20:09:54 +00:00
|
|
|
v.push(shared.len());
|
|
|
|
//[nll2015]~^ ERROR cannot borrow `v` as mutable
|
|
|
|
//[nll2018]~^^ ERROR cannot borrow `v` as mutable
|
|
|
|
//[migrate2015]~^^^ WARNING cannot borrow `v` as mutable
|
2019-03-25 23:16:39 +00:00
|
|
|
//[migrate2015]~| WARNING may become a hard error in the future
|
2019-03-13 19:17:59 +00:00
|
|
|
|
2019-03-01 20:09:54 +00:00
|
|
|
//[migrate2018]~^^^^^^ WARNING cannot borrow `v` as mutable
|
2019-03-25 23:16:39 +00:00
|
|
|
//[migrate2018]~| WARNING may become a hard error in the future
|
2017-12-06 11:25:36 +00:00
|
|
|
}
|
2019-03-01 20:09:54 +00:00
|
|
|
|
|
|
|
fn main() {}
|