Skip to content

Commit acd156d

Browse files
committed
add test that relies on non-reborrowing-cast-to-raw
1 parent aff1e43 commit acd156d

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

tests/run-pass/stacked-borrows/stacked-borrows.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,15 @@ fn two_raw() { unsafe {
129129
} }
130130

131131
// Make sure that creating a *mut does not invalidate existing shared references.
132-
fn shr_and_raw() { /* unsafe {
132+
fn shr_and_raw() { unsafe {
133133
use std::mem;
134-
// FIXME: This is currently disabled because "as *mut _" incurs a reborrow.
135134
let x = &mut 0;
136135
let y1: &i32 = mem::transmute(&*x); // launder lifetimes
137136
let y2 = x as *mut _;
138137
let _val = *y1;
139138
*y2 += 1;
140139
// TODO: Once this works, add compile-fail test that tries to read from y1 again.
141-
} */ }
140+
} }
142141

143142
fn disjoint_mutable_subborrows() {
144143
struct Foo {
@@ -165,5 +164,5 @@ fn disjoint_mutable_subborrows() {
165164
let b = unsafe{ borrow_field_b(ptr) };
166165
b.push(4);
167166
a.push_str(" world");
168-
dbg!(a,b);
167+
eprintln!("{:?} {:?}", a, b);
169168
}
Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
1-
[$DIR/stacked-borrows.rs:168] a = "hello world"
2-
[$DIR/stacked-borrows.rs:168] b = [
3-
0,
4-
1,
5-
2,
6-
4,
7-
]
1+
"hello world" [0, 1, 2, 4]

0 commit comments

Comments
 (0)