Skip to content

Commit 8884ea4

Browse files
committed
Auto merge of rust-lang#2367 - RalfJung:ui-test-regex, r=RalfJung
use ui_test regex capabilities We can have more precise patterns now, so use them for some of the tests where that makes sense. :)
2 parents 4e9de31 + 757e88c commit 8884ea4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+54
-53
lines changed

tests/fail/alloc/global_system_mixup.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Make sure we detect when the `Global` and `System` allocators are mixed
22
// (even when the default `Global` uses `System`).
3-
//@error-pattern: which is Rust heap memory, using
3+
//@error-pattern: /deallocating .*, which is Rust heap memory, using .* heap deallocation operation/
44

55
//@normalize-stderr-test: "using [A-Za-z]+ heap deallocation operation" -> "using PLATFORM heap deallocation operation"
66
//@normalize-stderr-test: "\| +\^+" -> "| ^"

tests/fail/alloc/stack_free.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Validation/SB changes why we fail
22
//@compile-flags: -Zmiri-disable-validation -Zmiri-disable-stacked-borrows
33

4-
//@error-pattern: which is stack variable memory, using Rust heap deallocation operation
4+
//@error-pattern: /deallocating .*, which is stack variable memory, using Rust heap deallocation operation/
55

66
fn main() {
77
let x = 42;

tests/fail/provenance/ptr_int_unexposed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ fn main() {
88
let x_usize: usize = x_ptr.addr();
99
// Cast back an address that did *not* get exposed.
1010
let ptr = std::ptr::from_exposed_addr::<i32>(x_usize);
11-
assert_eq!(unsafe { *ptr }, 3); //~ ERROR: Undefined Behavior: dereferencing pointer failed
11+
assert_eq!(unsafe { *ptr }, 3); //~ ERROR: is a dangling pointer
1212
}

tests/fail/stacked_borrows/alias_through_mutation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ fn main() {
1111
retarget(&mut target_alias, target);
1212
// now `target_alias` points to the same thing as `target`
1313
*target = 13;
14-
let _val = *target_alias; //~ ERROR: borrow stack
14+
let _val = *target_alias; //~ ERROR: /read access .* tag does not exist in the borrow stack/
1515
}

tests/fail/stacked_borrows/box_exclusive_violation1.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fn demo_mut_advanced_unique(mut our: Box<i32>) -> i32 {
1+
fn demo_box_advanced_unique(mut our: Box<i32>) -> i32 {
22
unknown_code_1(&*our);
33

44
// This "re-asserts" uniqueness of the reference: After writing, we know
@@ -24,10 +24,10 @@ fn unknown_code_1(x: &i32) {
2424

2525
fn unknown_code_2() {
2626
unsafe {
27-
*LEAK = 7; //~ ERROR: borrow stack
27+
*LEAK = 7; //~ ERROR: /write access .* tag does not exist in the borrow stack/
2828
}
2929
}
3030

3131
fn main() {
32-
demo_mut_advanced_unique(Box::new(0));
32+
demo_box_advanced_unique(Box::new(0));
3333
}

tests/fail/stacked_borrows/box_exclusive_violation1.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ LL | *our = 5;
2121
| ^^^^^^^^
2222
= note: backtrace:
2323
= note: inside `unknown_code_2` at $DIR/box_exclusive_violation1.rs:LL:CC
24-
note: inside `demo_mut_advanced_unique` at $DIR/box_exclusive_violation1.rs:LL:CC
24+
note: inside `demo_box_advanced_unique` at $DIR/box_exclusive_violation1.rs:LL:CC
2525
--> $DIR/box_exclusive_violation1.rs:LL:CC
2626
|
2727
LL | unknown_code_2();
2828
| ^^^^^^^^^^^^^^^^
2929
note: inside `main` at $DIR/box_exclusive_violation1.rs:LL:CC
3030
--> $DIR/box_exclusive_violation1.rs:LL:CC
3131
|
32-
LL | demo_mut_advanced_unique(Box::new(0));
32+
LL | demo_box_advanced_unique(Box::new(0));
3333
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3434

3535
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

tests/fail/stacked_borrows/buggy_as_mut_slice.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ fn main() {
1111
let v1 = safe::as_mut_slice(&v);
1212
let _v2 = safe::as_mut_slice(&v);
1313
v1[1] = 5;
14-
//~^ ERROR: borrow stack
14+
//~^ ERROR: /write access .* tag does not exist in the borrow stack/
1515
}

tests/fail/stacked_borrows/buggy_split_at_mut.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ mod safe {
1919
fn main() {
2020
let mut array = [1, 2, 3, 4];
2121
let (a, b) = safe::split_at_mut(&mut array, 0);
22-
//~^ ERROR: borrow stack
22+
//~^ ERROR: /reborrow .* tag does not exist in the borrow stack/
2323
a[1] = 5;
2424
b[1] = 6;
2525
}

tests/fail/stacked_borrows/exposed_only_ro.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ fn main() {
88
let _fool = &mut x as *mut i32; // this would have fooled the old untagged pointer logic
99
let addr = (&x as *const i32).expose_addr();
1010
let ptr = std::ptr::from_exposed_addr_mut::<i32>(addr);
11-
unsafe { *ptr = 0 }; //~ ERROR: borrow stack
11+
unsafe { *ptr = 0 }; //~ ERROR: /write access using <wildcard> .* no exposed tags have suitable permission in the borrow stack/
1212
}

tests/fail/stacked_borrows/illegal_read1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fn main() {
88
let xref = unsafe { &mut *xraw }; // derived from raw, so using raw is still ok...
99
callee(xraw);
1010
let _val = *xref; // ...but any use of raw will invalidate our ref.
11-
//~^ ERROR: borrow stack
11+
//~^ ERROR: /read access .* tag does not exist in the borrow stack/
1212
}
1313

1414
fn callee(xraw: *mut i32) {

tests/fail/stacked_borrows/illegal_read2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fn main() {
88
let xref = unsafe { &mut *xraw }; // derived from raw, so using raw is still ok...
99
callee(xraw);
1010
let _val = *xref; // ...but any use of raw will invalidate our ref.
11-
//~^ ERROR: borrow stack
11+
//~^ ERROR: /read access .* tag does not exist in the borrow stack/
1212
}
1313

1414
fn callee(xraw: *mut i32) {

tests/fail/stacked_borrows/illegal_read3.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fn main() {
1818
callee(xref1_sneaky);
1919
// ... though any use of it will invalidate our ref.
2020
let _val = *xref2;
21-
//~^ ERROR: borrow stack
21+
//~^ ERROR: /read access .* tag does not exist in the borrow stack/
2222
}
2323

2424
fn callee(xref1: HiddenRef) {

tests/fail/stacked_borrows/illegal_read4.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ fn main() {
55
let xraw = xref1 as *mut _;
66
let xref2 = unsafe { &mut *xraw };
77
let _val = unsafe { *xraw }; // use the raw again, this invalidates xref2 *even* with the special read except for uniq refs
8-
let _illegal = *xref2; //~ ERROR: borrow stack
8+
let _illegal = *xref2; //~ ERROR: /read access .* tag does not exist in the borrow stack/
99
}

tests/fail/stacked_borrows/illegal_read5.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ fn main() {
1414
let _val = *xref; // we can even still use our mutable reference
1515
mem::forget(unsafe { ptr::read(xshr) }); // but after reading through the shared ref
1616
let _val = *xref; // the mutable one is dead and gone
17-
//~^ ERROR: borrow stack
17+
//~^ ERROR: /read access .* tag does not exist in the borrow stack/
1818
}

tests/fail/stacked_borrows/illegal_read6.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ fn main() {
55
let raw = x as *mut _;
66
let x = &mut *x; // kill `raw`
77
let _y = &*x; // this should not activate `raw` again
8-
let _val = *raw; //~ ERROR: borrow stack
8+
let _val = *raw; //~ ERROR: /read access .* tag does not exist in the borrow stack/
99
}
1010
}

tests/fail/stacked_borrows/illegal_read7.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ fn main() {
1717
// without invalidating `x`. That would be bad! It would mean that creating `shr`
1818
// leaked `x` to `raw`.
1919
let _val = ptr::read(raw);
20-
let _val = *x.get_mut(); //~ ERROR: borrow stack
20+
let _val = *x.get_mut(); //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
2121
}
2222
}

tests/fail/stacked_borrows/illegal_read8.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ fn main() {
1010
let _val = *y2;
1111
let _val = *y1;
1212
*y2 += 1;
13-
let _fail = *y1; //~ ERROR: borrow stack
13+
let _fail = *y1; //~ ERROR: /read access .* tag does not exist in the borrow stack/
1414
}
1515
}

tests/fail/stacked_borrows/illegal_read_despite_exposed1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ fn main() {
1212
// And we test that it has uniqueness by doing a conflicting write.
1313
*exposed_ptr = 0;
1414
// Stack: Unknown(<N)
15-
let _val = *root2; //~ ERROR: borrow stack
15+
let _val = *root2; //~ ERROR: /read access .* tag does not exist in the borrow stack/
1616
}
1717
}

tests/fail/stacked_borrows/illegal_read_despite_exposed2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ fn main() {
1515
// Stack: Unknown(<N), Disabled(N)
1616
// collapsed to Unknown(<N)
1717
// Stack if _fool existed: Unknown(<N), Disabled(N), SRW(N+1); collapsed to Unknown(<N+2) which would not cause an ERROR
18-
let _val = *root2; //~ ERROR: borrow stack
18+
let _val = *root2; //~ ERROR: /read access .* tag does not exist in the borrow stack/
1919
}
2020
}

tests/fail/stacked_borrows/illegal_write1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ fn main() {
33
let xref = &*target;
44
{
55
let x: *mut u32 = xref as *const _ as *mut _;
6-
unsafe { *x = 42 }; //~ ERROR: only grants SharedReadOnly permission
6+
unsafe { *x = 42 }; //~ ERROR: /write access .* tag only grants SharedReadOnly permission/
77
}
88
let _x = *xref;
99
}

tests/fail/stacked_borrows/illegal_write2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ fn main() {
33
let target2 = target as *mut _;
44
drop(&mut *target); // reborrow
55
// Now make sure our ref is still the only one.
6-
unsafe { *target2 = 13 }; //~ ERROR: borrow stack
6+
unsafe { *target2 = 13 }; //~ ERROR: /write access .* tag does not exist in the borrow stack/
77
let _val = *target;
88
}

tests/fail/stacked_borrows/illegal_write3.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ fn main() {
33
// Make sure raw ptr with raw tag cannot mutate frozen location without breaking the shared ref.
44
let r#ref = &target; // freeze
55
let ptr = r#ref as *const _ as *mut _; // raw ptr, with raw tag
6-
unsafe { *ptr = 42 }; //~ ERROR: only grants SharedReadOnly permission
6+
unsafe { *ptr = 42 }; //~ ERROR: /write access .* only grants SharedReadOnly permission/
77
let _val = *r#ref;
88
}

tests/fail/stacked_borrows/illegal_write4.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ fn main() {
99
let _ptr = reference as *const _ as *mut i32; // raw ptr, with raw tag
1010
let _mut_ref: &mut i32 = unsafe { mem::transmute(raw) }; // &mut, with raw tag
1111
// Now we retag, making our ref top-of-stack -- and, in particular, unfreezing.
12-
let _val = *reference; //~ ERROR: borrow stack
12+
let _val = *reference; //~ ERROR: /read access .* tag does not exist in the borrow stack/
1313
}

tests/fail/stacked_borrows/illegal_write5.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fn main() {
88
callee(xraw);
99
// ... though any use of raw value will invalidate our ref.
1010
let _val = *xref;
11-
//~^ ERROR: borrow stack
11+
//~^ ERROR: /read access .* tag does not exist in the borrow stack/
1212
}
1313

1414
fn callee(xraw: *mut i32) {

tests/fail/stacked_borrows/illegal_write6.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ fn main() {
77
fn foo(a: &mut u32, y: *mut u32) -> u32 {
88
*a = 1;
99
let _b = &*a;
10-
unsafe { *y = 2 }; //~ ERROR: not granting access to tag
10+
unsafe { *y = 2 }; //~ ERROR: /not granting access .* because incompatible item .* is protected/
1111
return *a;
1212
}

tests/fail/stacked_borrows/illegal_write_despite_exposed1.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ fn main() {
99
let root2 = &*exposed_ptr;
1010
// Stack: Unknown(<N), SRO(N), SRO(N+1)
1111
// And we test that it is read-only by doing a conflicting write.
12+
// (The write is still fine, using the `root as *mut i32` provenance which got exposed.)
1213
*exposed_ptr = 0;
1314
// Stack: Unknown(<N)
14-
let _val = *root2; //~ ERROR: borrow stack
15+
let _val = *root2; //~ ERROR: /read access .* tag does not exist in the borrow stack/
1516
}
1617
}

tests/fail/stacked_borrows/interior_mut1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ fn main() {
1212
*c.get() = UnsafeCell::new(1); // invalidates inner_shr
1313
// stack: [c: SharedReadWrite]
1414

15-
let _val = *inner_shr.get(); //~ ERROR: borrow stack
15+
let _val = *inner_shr.get(); //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
1616
}
1717
}

tests/fail/stacked_borrows/interior_mut2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ fn main() {
2525
// stack: [c: SharedReadWrite]
2626

2727
// now this does not work any more
28-
let _val = *inner_shr.get(); //~ ERROR: borrow stack
28+
let _val = *inner_shr.get(); //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
2929
}
3030
}

tests/fail/stacked_borrows/load_invalid_mut.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ fn main() {
88
let xref = unsafe { &mut *xraw };
99
let xref_in_mem = Box::new(xref);
1010
let _val = unsafe { *xraw }; // invalidate xref
11-
let _val = *xref_in_mem; //~ ERROR: borrow stack
11+
let _val = *xref_in_mem; //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
1212
}

tests/fail/stacked_borrows/load_invalid_shr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ fn main() {
88
let xref = unsafe { &*xraw };
99
let xref_in_mem = Box::new(xref);
1010
unsafe { *xraw = 42 }; // unfreeze
11-
let _val = *xref_in_mem; //~ ERROR: borrow stack
11+
let _val = *xref_in_mem; //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
1212
}

tests/fail/stacked_borrows/mut_exclusive_violation1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn unknown_code_1(x: &i32) {
2424

2525
fn unknown_code_2() {
2626
unsafe {
27-
*LEAK = 7; //~ ERROR: borrow stack
27+
*LEAK = 7; //~ ERROR: /write access .* tag does not exist in the borrow stack/
2828
}
2929
}
3030

tests/fail/stacked_borrows/mut_exclusive_violation2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ fn main() {
77
let mut ptr2 = ptr1.clone();
88
let raw1 = ptr1.as_mut();
99
let _raw2 = ptr2.as_mut();
10-
let _val = *raw1; //~ ERROR: borrow stack
10+
let _val = *raw1; //~ ERROR: /read access .* tag does not exist in the borrow stack/
1111
}
1212
}

tests/fail/stacked_borrows/outdated_local.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ fn main() {
33
let y: *const i32 = &x;
44
x = 1; // this invalidates y by reactivating the lowermost uniq borrow for this local
55

6-
assert_eq!(unsafe { *y }, 1); //~ ERROR: borrow stack
6+
assert_eq!(unsafe { *y }, 1); //~ ERROR: /read access .* tag does not exist in the borrow stack/
77

88
assert_eq!(x, 1);
99
}

tests/fail/stacked_borrows/pass_invalid_mut.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ fn main() {
66
let xraw = x as *mut _;
77
let xref = unsafe { &mut *xraw };
88
let _val = unsafe { *xraw }; // invalidate xref
9-
foo(xref); //~ ERROR: borrow stack
9+
foo(xref); //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
1010
}

tests/fail/stacked_borrows/pass_invalid_shr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ fn main() {
66
let xraw = x as *mut _;
77
let xref = unsafe { &*xraw };
88
unsafe { *xraw = 42 }; // unfreeze
9-
foo(xref); //~ ERROR: borrow stack
9+
foo(xref); //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
1010
}

tests/fail/stacked_borrows/pointer_smuggling.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fn fun1(x: &mut u8) {
88

99
fn fun2() {
1010
// Now we use a pointer we are not allowed to use
11-
let _x = unsafe { *PTR }; //~ ERROR: borrow stack
11+
let _x = unsafe { *PTR }; //~ ERROR: /read access .* tag does not exist in the borrow stack/
1212
}
1313

1414
fn main() {

tests/fail/stacked_borrows/raw_tracking.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ fn main() {
66
let raw2 = &mut l as *mut _; // invalidates raw1
77
// Without raw pointer tracking, Stacked Borrows cannot distinguish raw1 and raw2, and thus
88
// fails to realize that raw1 should not be used any more.
9-
unsafe { *raw1 = 13 }; //~ ERROR: does not exist in the borrow stack
9+
unsafe { *raw1 = 13 }; //~ ERROR: /write access .* tag does not exist in the borrow stack/
1010
unsafe { *raw2 = 13 };
1111
}

tests/fail/stacked_borrows/return_invalid_mut.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ fn foo(x: &mut (i32, i32)) -> &mut i32 {
33
let xraw = x as *mut (i32, i32);
44
let ret = unsafe { &mut (*xraw).1 };
55
let _val = unsafe { *xraw }; // invalidate xref
6-
ret //~ ERROR: borrow stack
6+
ret //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
77
}
88

99
fn main() {

tests/fail/stacked_borrows/return_invalid_mut_option.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fn foo(x: &mut (i32, i32)) -> Option<&mut i32> {
1010

1111
fn main() {
1212
match foo(&mut (1, 2)) {
13-
Some(_x) => {} //~ ERROR: borrow stack
13+
Some(_x) => {} //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
1414
None => {}
1515
}
1616
}

tests/fail/stacked_borrows/return_invalid_mut_tuple.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ fn foo(x: &mut (i32, i32)) -> (&mut i32,) {
88
}
99

1010
fn main() {
11-
foo(&mut (1, 2)).0; //~ ERROR: borrow stack
11+
foo(&mut (1, 2)).0; //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
1212
}

tests/fail/stacked_borrows/return_invalid_shr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ fn foo(x: &mut (i32, i32)) -> &i32 {
33
let xraw = x as *mut (i32, i32);
44
let ret = unsafe { &(*xraw).1 };
55
unsafe { *xraw = (42, 23) }; // unfreeze
6-
ret //~ ERROR: borrow stack
6+
ret //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
77
}
88

99
fn main() {

tests/fail/stacked_borrows/return_invalid_shr_option.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fn foo(x: &mut (i32, i32)) -> Option<&i32> {
99

1010
fn main() {
1111
match foo(&mut (1, 2)) {
12-
Some(_x) => {} //~ ERROR: borrow stack
12+
Some(_x) => {} //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
1313
None => {}
1414
}
1515
}

tests/fail/stacked_borrows/return_invalid_shr_tuple.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ fn foo(x: &mut (i32, i32)) -> (&i32,) {
88
}
99

1010
fn main() {
11-
foo(&mut (1, 2)).0; //~ ERROR: borrow stack
11+
foo(&mut (1, 2)).0; //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
1212
}

tests/fail/stacked_borrows/shared_rw_borrows_are_weak1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ fn main() {
1111
let y: &mut Cell<i32> = mem::transmute(&mut *x); // launder lifetime
1212
let shr_rw = &*x; // thanks to interior mutability this will be a SharedReadWrite
1313
shr_rw.set(1);
14-
y.get_mut(); //~ ERROR: borrow stack
14+
y.get_mut(); //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
1515
}
1616
}

tests/fail/stacked_borrows/shared_rw_borrows_are_weak2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ fn main() {
1212
let y: &i32 = mem::transmute(&*x.borrow()); // launder lifetime
1313
let shr_rw = &*x; // thanks to interior mutability this will be a SharedReadWrite
1414
shr_rw.replace(1);
15-
let _val = *y; //~ ERROR: borrow stack
15+
let _val = *y; //~ ERROR: /read access .* tag does not exist in the borrow stack/
1616
}
1717
}

tests/fail/stacked_borrows/shr_frozen_violation1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ fn main() {
1010

1111
fn unknown_code(x: &i32) {
1212
unsafe {
13-
*(x as *const i32 as *mut i32) = 7; //~ ERROR: only grants SharedReadOnly permission
13+
*(x as *const i32 as *mut i32) = 7; //~ ERROR: /write access .* only grants SharedReadOnly permission/
1414
}
1515
}

tests/fail/stacked_borrows/transmute-is-no-escape.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ fn main() {
1010
let _raw: *mut i32 = unsafe { mem::transmute(&mut x[0]) };
1111
// `raw` still carries a tag, so we get another pointer to the same location that does not carry a tag
1212
let raw = (&mut x[1] as *mut i32).wrapping_offset(-1);
13-
unsafe { *raw = 13 }; //~ ERROR: borrow stack
13+
unsafe { *raw = 13 }; //~ ERROR: /write access .* tag does not exist in the borrow stack/
1414
}

0 commit comments

Comments
 (0)