From 31c749247b30c1f88c0842a26f4f9956c92404be Mon Sep 17 00:00:00 2001 From: Son Ho Date: Wed, 5 Jun 2024 16:48:22 +0200 Subject: Add more tests --- tests/src/loops-borrow-check-fail.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/src/loops-borrow-check-fail.rs (limited to 'tests/src/loops-borrow-check-fail.rs') diff --git a/tests/src/loops-borrow-check-fail.rs b/tests/src/loops-borrow-check-fail.rs new file mode 100644 index 00000000..24be052c --- /dev/null +++ b/tests/src/loops-borrow-check-fail.rs @@ -0,0 +1,21 @@ +//@ [!borrow-check] skip +//@ [borrow-check] known-failure + +// We need to use the general rules for joining the loans +fn loop_reborrow_mut() { + let mut x = 0; + let mut px = &mut x; + while *px > 0 { + x += 1; + px = &mut x; + } +} + +// We need to imrpove [prepare_ashared_loans] +fn iter_local_shared_borrow() { + let mut x = 0; + let mut p = &x; + loop { + p = &(*p); + } +} -- cgit v1.2.3