test: Add two tests for issue #6272.

This commit is contained in:
Niko Matsakis 2013-05-09 17:20:31 -04:00
parent ca95e7f94e
commit 9482ed729e
2 changed files with 62 additions and 0 deletions

View file

@ -0,0 +1,21 @@
// error-pattern:borrowed
// Issue #6272. Tests that freezing correctly accounts for all the
// implicit derefs that can occur and freezes the innermost box. See
// the companion test
//
// run-pass/borrowck-wg-autoderef-and-autoborrowvec-combined-issue-6272.rs
//
// for a detailed explanation of what is going on here.
fn main() {
let a = @mut [3i];
let b = @mut [a];
let c = @mut b;
// this should freeze `a` only
let x: &mut [int] = c[0];
// hence this should fail
a[0] = a[0];
}