blob: 3e125869ef1e9272c27fe6336210b1117651d2d2 [file] [log] [blame]
// Test for #56254. The last example originally failed with the ast checker, was
// accidentally allowed under migrate/nll, then linted against in migrate mode
// but disallowed under NLL. Now, we accept it everywhere.
//ignore-compare-mode-nll
//ignore-compare-mode-polonius
//revisions: base nll
//[migrate2018] edition:2018
//[nll2018] edition:2018
#![cfg_attr(nll, feature(nll))]
fn double_conflicts() {
let mut v = vec![0, 1, 2];
let shared = &v;
v.extend(shared);
//[base]~^ ERROR cannot borrow `v` as mutable
//[nll]~^^ ERROR cannot borrow `v` as mutable
}
fn activation_conflict() {
let mut v = vec![0, 1, 2];
v.extend(&v);
//[base]~^ ERROR cannot borrow `v` as mutable
//[nll]~^^ ERROR cannot borrow `v` as mutable
}
fn reservation_allowed() {
let mut v = vec![0, 1, 2];
let shared = &v;
v.push(shared.len());
}
fn main() {}