From fd57717b16ee8378a7333e8e128bcf62ba6db78b Mon Sep 17 00:00:00 2001 From: Flavio Percoco Date: Sun, 16 Feb 2014 00:00:38 +0100 Subject: [PATCH] Add test and close #8893 --- ...owck-move-from-subpath-of-borrowed-path.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/test/compile-fail/borrowck-move-from-subpath-of-borrowed-path.rs 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 0000000000000..6106644a26310 --- /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 or the MIT license +// , 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 +}