diff options
| author | Flavio Percoco <flaper87@gmail.com> | 2014-02-16 00:00:38 +0100 |
|---|---|---|
| committer | Flavio Percoco <flaper87@gmail.com> | 2014-02-16 00:00:38 +0100 |
| commit | fd57717b16ee8378a7333e8e128bcf62ba6db78b (patch) | |
| tree | cbd4bf6c2ed12cfbc9a41f96a37d3b00a971f3f6 | |
| parent | 4af28c98fac5bc36a93527b79c77081eedfb554b (diff) | |
| download | rust-fd57717b16ee8378a7333e8e128bcf62ba6db78b.tar.gz rust-fd57717b16ee8378a7333e8e128bcf62ba6db78b.zip | |
Add test and close #8893
| -rw-r--r-- | src/test/compile-fail/borrowck-move-from-subpath-of-borrowed-path.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/compile-fail/borrowck-move-from-subpath-of-borrowed-path.rs b/src/test/compile-fail/borrowck-move-from-subpath-of-borrowed-path.rs new file mode 100644 index 00000000000..6106644a263 --- /dev/null +++ b/src/test/compile-fail/borrowck-move-from-subpath-of-borrowed-path.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// verify that an error is raised when trying to move out of a +// borrowed path. + +fn main() { + let a = ~~2; + let b = &a; + + let z = *a; //~ ERROR: cannot move out of `*a` because it is borrowed +} |
