diff options
| author | bors <bors@rust-lang.org> | 2017-12-09 22:32:34 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-12-09 22:32:34 +0000 |
| commit | 8db163e53dab4f188a60bf24b4d6ebeb1ea5cab1 (patch) | |
| tree | d3be9c603291bfc560d1d8caab8a8d0761c53d31 /src/test/compile-fail | |
| parent | 6fa53b00e7450060a3af9b1ef63169db37e589c2 (diff) | |
| parent | 90f7c31d86a82cefddc3307f5fd491dd264119c4 (diff) | |
| download | rust-8db163e53dab4f188a60bf24b4d6ebeb1ea5cab1.tar.gz rust-8db163e53dab4f188a60bf24b4d6ebeb1ea5cab1.zip | |
Auto merge of #46572 - vramana:fix-45638, r=estebank
Fix bad error message for cannot_reborrow_already_uniquely_borrowed
Diffstat (limited to 'src/test/compile-fail')
| -rw-r--r-- | src/test/compile-fail/E0501.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/test/compile-fail/E0501.rs b/src/test/compile-fail/E0501.rs index 04678b96c8d..f7e246e8f0f 100644 --- a/src/test/compile-fail/E0501.rs +++ b/src/test/compile-fail/E0501.rs @@ -8,17 +8,28 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-tidy-linelength +// revisions: ast mir +//[mir]compile-flags: -Z borrowck=mir + fn inside_closure(x: &mut i32) { } -fn outside_closure(x: &mut i32) { +fn outside_closure_1(x: &mut i32) { +} + +fn outside_closure_2(x: &i32) { } fn foo(a: &mut i32) { let bar = || { inside_closure(a) }; - outside_closure(a); //~ ERROR E0501 + outside_closure_1(a); //[ast]~ ERROR cannot borrow `*a` as mutable because previous closure requires unique access + //[mir]~^ ERROR cannot borrow `*a` as mutable because previous closure requires unique access + + outside_closure_2(a); //[ast]~ ERROR cannot borrow `*a` as immutable because previous closure requires unique access + //[mir]~^ ERROR cannot borrow `*a` as immutable because previous closure requires unique access } fn main() { |
