diff options
| author | bors <bors@rust-lang.org> | 2014-02-15 22:06:27 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-02-15 22:06:27 -0800 |
| commit | 5d4fd50af3c16ffe43c8035b929374e13bb76793 (patch) | |
| tree | c19727c83d9cf49464350e8dc8c4db48f80f84e5 | |
| parent | f3d4fe75000eba9ff575d37fd1a2acba942fa68e (diff) | |
| parent | fd57717b16ee8378a7333e8e128bcf62ba6db78b (diff) | |
| download | rust-5d4fd50af3c16ffe43c8035b929374e13bb76793.tar.gz rust-5d4fd50af3c16ffe43c8035b929374e13bb76793.zip | |
auto merge of #12301 : FlaPer87/rust/issue-8893, r=alexcrichton
| -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 +} |
