From cf10bcfe4861ce01fe932300fa64dbb4484f3ef7 Mon Sep 17 00:00:00 2001 From: Josh Leeb-du Toit Date: Mon, 30 Oct 2017 09:58:45 +1100 Subject: [PATCH] Move issue-42106 test from compile-fail to ui --- src/test/{compile-fail => ui}/issue-42106.rs | 2 +- src/test/ui/issue-42106.stderr | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) rename src/test/{compile-fail => ui}/issue-42106.rs (92%) create mode 100644 src/test/ui/issue-42106.stderr diff --git a/src/test/compile-fail/issue-42106.rs b/src/test/ui/issue-42106.rs similarity index 92% rename from src/test/compile-fail/issue-42106.rs rename to src/test/ui/issue-42106.rs index a9aa94b5b08..f13f1dd1145 100644 --- a/src/test/compile-fail/issue-42106.rs +++ b/src/test/ui/issue-42106.rs @@ -10,7 +10,7 @@ fn do_something(collection: &mut Vec) { let _a = &collection; - collection.swap(1, 2); //~ ERROR E0502 + collection.swap(1, 2); } fn main() {} diff --git a/src/test/ui/issue-42106.stderr b/src/test/ui/issue-42106.stderr new file mode 100644 index 00000000000..481cdb5f5b2 --- /dev/null +++ b/src/test/ui/issue-42106.stderr @@ -0,0 +1,12 @@ +error[E0502]: cannot borrow `*collection` as mutable because `collection` is also borrowed as immutable + --> $DIR/issue-42106.rs:13:5 + | +12 | let _a = &collection; + | ---------- immutable borrow occurs here +13 | collection.swap(1, 2); + | ^^^^^^^^^^ mutable borrow occurs here +14 | } + | - immutable borrow ends here + +error: aborting due to 2 previous errors +