Skip to content

Commit

Permalink
Auto merge of rust-lang#2367 - RalfJung:ui-test-regex, r=RalfJung
Browse files Browse the repository at this point in the history
use ui_test regex capabilities

We can have more precise patterns now, so use them for some of the tests where that makes sense. :)
  • Loading branch information
bors committed Jul 13, 2022
2 parents 4e9de31 + 757e88c commit 8884ea4
Show file tree
Hide file tree
Showing 50 changed files with 54 additions and 53 deletions.
2 changes: 1 addition & 1 deletion tests/fail/alloc/global_system_mixup.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Make sure we detect when the `Global` and `System` allocators are mixed
// (even when the default `Global` uses `System`).
//@error-pattern: which is Rust heap memory, using
//@error-pattern: /deallocating .*, which is Rust heap memory, using .* heap deallocation operation/

//@normalize-stderr-test: "using [A-Za-z]+ heap deallocation operation" -> "using PLATFORM heap deallocation operation"
//@normalize-stderr-test: "\| +\^+" -> "| ^"
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/alloc/stack_free.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Validation/SB changes why we fail
//@compile-flags: -Zmiri-disable-validation -Zmiri-disable-stacked-borrows

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

fn main() {
let x = 42;
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/provenance/ptr_int_unexposed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ fn main() {
let x_usize: usize = x_ptr.addr();
// Cast back an address that did *not* get exposed.
let ptr = std::ptr::from_exposed_addr::<i32>(x_usize);
assert_eq!(unsafe { *ptr }, 3); //~ ERROR: Undefined Behavior: dereferencing pointer failed
assert_eq!(unsafe { *ptr }, 3); //~ ERROR: is a dangling pointer
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/alias_through_mutation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ fn main() {
retarget(&mut target_alias, target);
// now `target_alias` points to the same thing as `target`
*target = 13;
let _val = *target_alias; //~ ERROR: borrow stack
let _val = *target_alias; //~ ERROR: /read access .* tag does not exist in the borrow stack/
}
6 changes: 3 additions & 3 deletions tests/fail/stacked_borrows/box_exclusive_violation1.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fn demo_mut_advanced_unique(mut our: Box<i32>) -> i32 {
fn demo_box_advanced_unique(mut our: Box<i32>) -> i32 {
unknown_code_1(&*our);

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

fn unknown_code_2() {
unsafe {
*LEAK = 7; //~ ERROR: borrow stack
*LEAK = 7; //~ ERROR: /write access .* tag does not exist in the borrow stack/
}
}

fn main() {
demo_mut_advanced_unique(Box::new(0));
demo_box_advanced_unique(Box::new(0));
}
4 changes: 2 additions & 2 deletions tests/fail/stacked_borrows/box_exclusive_violation1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ LL | *our = 5;
| ^^^^^^^^
= note: backtrace:
= note: inside `unknown_code_2` at $DIR/box_exclusive_violation1.rs:LL:CC
note: inside `demo_mut_advanced_unique` at $DIR/box_exclusive_violation1.rs:LL:CC
note: inside `demo_box_advanced_unique` at $DIR/box_exclusive_violation1.rs:LL:CC
--> $DIR/box_exclusive_violation1.rs:LL:CC
|
LL | unknown_code_2();
| ^^^^^^^^^^^^^^^^
note: inside `main` at $DIR/box_exclusive_violation1.rs:LL:CC
--> $DIR/box_exclusive_violation1.rs:LL:CC
|
LL | demo_mut_advanced_unique(Box::new(0));
LL | demo_box_advanced_unique(Box::new(0));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/buggy_as_mut_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ fn main() {
let v1 = safe::as_mut_slice(&v);
let _v2 = safe::as_mut_slice(&v);
v1[1] = 5;
//~^ ERROR: borrow stack
//~^ ERROR: /write access .* tag does not exist in the borrow stack/
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/buggy_split_at_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mod safe {
fn main() {
let mut array = [1, 2, 3, 4];
let (a, b) = safe::split_at_mut(&mut array, 0);
//~^ ERROR: borrow stack
//~^ ERROR: /reborrow .* tag does not exist in the borrow stack/
a[1] = 5;
b[1] = 6;
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/exposed_only_ro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ fn main() {
let _fool = &mut x as *mut i32; // this would have fooled the old untagged pointer logic
let addr = (&x as *const i32).expose_addr();
let ptr = std::ptr::from_exposed_addr_mut::<i32>(addr);
unsafe { *ptr = 0 }; //~ ERROR: borrow stack
unsafe { *ptr = 0 }; //~ ERROR: /write access using <wildcard> .* no exposed tags have suitable permission in the borrow stack/
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/illegal_read1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fn main() {
let xref = unsafe { &mut *xraw }; // derived from raw, so using raw is still ok...
callee(xraw);
let _val = *xref; // ...but any use of raw will invalidate our ref.
//~^ ERROR: borrow stack
//~^ ERROR: /read access .* tag does not exist in the borrow stack/
}

fn callee(xraw: *mut i32) {
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/illegal_read2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fn main() {
let xref = unsafe { &mut *xraw }; // derived from raw, so using raw is still ok...
callee(xraw);
let _val = *xref; // ...but any use of raw will invalidate our ref.
//~^ ERROR: borrow stack
//~^ ERROR: /read access .* tag does not exist in the borrow stack/
}

fn callee(xraw: *mut i32) {
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/illegal_read3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn main() {
callee(xref1_sneaky);
// ... though any use of it will invalidate our ref.
let _val = *xref2;
//~^ ERROR: borrow stack
//~^ ERROR: /read access .* tag does not exist in the borrow stack/
}

fn callee(xref1: HiddenRef) {
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/illegal_read4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ fn main() {
let xraw = xref1 as *mut _;
let xref2 = unsafe { &mut *xraw };
let _val = unsafe { *xraw }; // use the raw again, this invalidates xref2 *even* with the special read except for uniq refs
let _illegal = *xref2; //~ ERROR: borrow stack
let _illegal = *xref2; //~ ERROR: /read access .* tag does not exist in the borrow stack/
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/illegal_read5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ fn main() {
let _val = *xref; // we can even still use our mutable reference
mem::forget(unsafe { ptr::read(xshr) }); // but after reading through the shared ref
let _val = *xref; // the mutable one is dead and gone
//~^ ERROR: borrow stack
//~^ ERROR: /read access .* tag does not exist in the borrow stack/
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/illegal_read6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ fn main() {
let raw = x as *mut _;
let x = &mut *x; // kill `raw`
let _y = &*x; // this should not activate `raw` again
let _val = *raw; //~ ERROR: borrow stack
let _val = *raw; //~ ERROR: /read access .* tag does not exist in the borrow stack/
}
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/illegal_read7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ fn main() {
// without invalidating `x`. That would be bad! It would mean that creating `shr`
// leaked `x` to `raw`.
let _val = ptr::read(raw);
let _val = *x.get_mut(); //~ ERROR: borrow stack
let _val = *x.get_mut(); //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
}
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/illegal_read8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ fn main() {
let _val = *y2;
let _val = *y1;
*y2 += 1;
let _fail = *y1; //~ ERROR: borrow stack
let _fail = *y1; //~ ERROR: /read access .* tag does not exist in the borrow stack/
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ fn main() {
// And we test that it has uniqueness by doing a conflicting write.
*exposed_ptr = 0;
// Stack: Unknown(<N)
let _val = *root2; //~ ERROR: borrow stack
let _val = *root2; //~ ERROR: /read access .* tag does not exist in the borrow stack/
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ fn main() {
// Stack: Unknown(<N), Disabled(N)
// collapsed to Unknown(<N)
// Stack if _fool existed: Unknown(<N), Disabled(N), SRW(N+1); collapsed to Unknown(<N+2) which would not cause an ERROR
let _val = *root2; //~ ERROR: borrow stack
let _val = *root2; //~ ERROR: /read access .* tag does not exist in the borrow stack/
}
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/illegal_write1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ fn main() {
let xref = &*target;
{
let x: *mut u32 = xref as *const _ as *mut _;
unsafe { *x = 42 }; //~ ERROR: only grants SharedReadOnly permission
unsafe { *x = 42 }; //~ ERROR: /write access .* tag only grants SharedReadOnly permission/
}
let _x = *xref;
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/illegal_write2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ fn main() {
let target2 = target as *mut _;
drop(&mut *target); // reborrow
// Now make sure our ref is still the only one.
unsafe { *target2 = 13 }; //~ ERROR: borrow stack
unsafe { *target2 = 13 }; //~ ERROR: /write access .* tag does not exist in the borrow stack/
let _val = *target;
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/illegal_write3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ fn main() {
// Make sure raw ptr with raw tag cannot mutate frozen location without breaking the shared ref.
let r#ref = &target; // freeze
let ptr = r#ref as *const _ as *mut _; // raw ptr, with raw tag
unsafe { *ptr = 42 }; //~ ERROR: only grants SharedReadOnly permission
unsafe { *ptr = 42 }; //~ ERROR: /write access .* only grants SharedReadOnly permission/
let _val = *r#ref;
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/illegal_write4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ fn main() {
let _ptr = reference as *const _ as *mut i32; // raw ptr, with raw tag
let _mut_ref: &mut i32 = unsafe { mem::transmute(raw) }; // &mut, with raw tag
// Now we retag, making our ref top-of-stack -- and, in particular, unfreezing.
let _val = *reference; //~ ERROR: borrow stack
let _val = *reference; //~ ERROR: /read access .* tag does not exist in the borrow stack/
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/illegal_write5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fn main() {
callee(xraw);
// ... though any use of raw value will invalidate our ref.
let _val = *xref;
//~^ ERROR: borrow stack
//~^ ERROR: /read access .* tag does not exist in the borrow stack/
}

fn callee(xraw: *mut i32) {
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/illegal_write6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ fn main() {
fn foo(a: &mut u32, y: *mut u32) -> u32 {
*a = 1;
let _b = &*a;
unsafe { *y = 2 }; //~ ERROR: not granting access to tag
unsafe { *y = 2 }; //~ ERROR: /not granting access .* because incompatible item .* is protected/
return *a;
}
3 changes: 2 additions & 1 deletion tests/fail/stacked_borrows/illegal_write_despite_exposed1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ fn main() {
let root2 = &*exposed_ptr;
// Stack: Unknown(<N), SRO(N), SRO(N+1)
// And we test that it is read-only by doing a conflicting write.
// (The write is still fine, using the `root as *mut i32` provenance which got exposed.)
*exposed_ptr = 0;
// Stack: Unknown(<N)
let _val = *root2; //~ ERROR: borrow stack
let _val = *root2; //~ ERROR: /read access .* tag does not exist in the borrow stack/
}
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/interior_mut1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ fn main() {
*c.get() = UnsafeCell::new(1); // invalidates inner_shr
// stack: [c: SharedReadWrite]

let _val = *inner_shr.get(); //~ ERROR: borrow stack
let _val = *inner_shr.get(); //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
}
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/interior_mut2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ fn main() {
// stack: [c: SharedReadWrite]

// now this does not work any more
let _val = *inner_shr.get(); //~ ERROR: borrow stack
let _val = *inner_shr.get(); //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
}
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/load_invalid_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ fn main() {
let xref = unsafe { &mut *xraw };
let xref_in_mem = Box::new(xref);
let _val = unsafe { *xraw }; // invalidate xref
let _val = *xref_in_mem; //~ ERROR: borrow stack
let _val = *xref_in_mem; //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/load_invalid_shr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ fn main() {
let xref = unsafe { &*xraw };
let xref_in_mem = Box::new(xref);
unsafe { *xraw = 42 }; // unfreeze
let _val = *xref_in_mem; //~ ERROR: borrow stack
let _val = *xref_in_mem; //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/mut_exclusive_violation1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn unknown_code_1(x: &i32) {

fn unknown_code_2() {
unsafe {
*LEAK = 7; //~ ERROR: borrow stack
*LEAK = 7; //~ ERROR: /write access .* tag does not exist in the borrow stack/
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/mut_exclusive_violation2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ fn main() {
let mut ptr2 = ptr1.clone();
let raw1 = ptr1.as_mut();
let _raw2 = ptr2.as_mut();
let _val = *raw1; //~ ERROR: borrow stack
let _val = *raw1; //~ ERROR: /read access .* tag does not exist in the borrow stack/
}
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/outdated_local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ fn main() {
let y: *const i32 = &x;
x = 1; // this invalidates y by reactivating the lowermost uniq borrow for this local

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

assert_eq!(x, 1);
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/pass_invalid_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ fn main() {
let xraw = x as *mut _;
let xref = unsafe { &mut *xraw };
let _val = unsafe { *xraw }; // invalidate xref
foo(xref); //~ ERROR: borrow stack
foo(xref); //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/pass_invalid_shr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ fn main() {
let xraw = x as *mut _;
let xref = unsafe { &*xraw };
unsafe { *xraw = 42 }; // unfreeze
foo(xref); //~ ERROR: borrow stack
foo(xref); //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/pointer_smuggling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fn fun1(x: &mut u8) {

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

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/raw_tracking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ fn main() {
let raw2 = &mut l as *mut _; // invalidates raw1
// Without raw pointer tracking, Stacked Borrows cannot distinguish raw1 and raw2, and thus
// fails to realize that raw1 should not be used any more.
unsafe { *raw1 = 13 }; //~ ERROR: does not exist in the borrow stack
unsafe { *raw1 = 13 }; //~ ERROR: /write access .* tag does not exist in the borrow stack/
unsafe { *raw2 = 13 };
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/return_invalid_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ fn foo(x: &mut (i32, i32)) -> &mut i32 {
let xraw = x as *mut (i32, i32);
let ret = unsafe { &mut (*xraw).1 };
let _val = unsafe { *xraw }; // invalidate xref
ret //~ ERROR: borrow stack
ret //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
}

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/return_invalid_mut_option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn foo(x: &mut (i32, i32)) -> Option<&mut i32> {

fn main() {
match foo(&mut (1, 2)) {
Some(_x) => {} //~ ERROR: borrow stack
Some(_x) => {} //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
None => {}
}
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/return_invalid_mut_tuple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ fn foo(x: &mut (i32, i32)) -> (&mut i32,) {
}

fn main() {
foo(&mut (1, 2)).0; //~ ERROR: borrow stack
foo(&mut (1, 2)).0; //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/return_invalid_shr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ fn foo(x: &mut (i32, i32)) -> &i32 {
let xraw = x as *mut (i32, i32);
let ret = unsafe { &(*xraw).1 };
unsafe { *xraw = (42, 23) }; // unfreeze
ret //~ ERROR: borrow stack
ret //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
}

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/return_invalid_shr_option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn foo(x: &mut (i32, i32)) -> Option<&i32> {

fn main() {
match foo(&mut (1, 2)) {
Some(_x) => {} //~ ERROR: borrow stack
Some(_x) => {} //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
None => {}
}
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/return_invalid_shr_tuple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ fn foo(x: &mut (i32, i32)) -> (&i32,) {
}

fn main() {
foo(&mut (1, 2)).0; //~ ERROR: borrow stack
foo(&mut (1, 2)).0; //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/shared_rw_borrows_are_weak1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ fn main() {
let y: &mut Cell<i32> = mem::transmute(&mut *x); // launder lifetime
let shr_rw = &*x; // thanks to interior mutability this will be a SharedReadWrite
shr_rw.set(1);
y.get_mut(); //~ ERROR: borrow stack
y.get_mut(); //~ ERROR: /reborrow .* tag does not exist in the borrow stack/
}
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/shared_rw_borrows_are_weak2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ fn main() {
let y: &i32 = mem::transmute(&*x.borrow()); // launder lifetime
let shr_rw = &*x; // thanks to interior mutability this will be a SharedReadWrite
shr_rw.replace(1);
let _val = *y; //~ ERROR: borrow stack
let _val = *y; //~ ERROR: /read access .* tag does not exist in the borrow stack/
}
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/shr_frozen_violation1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ fn main() {

fn unknown_code(x: &i32) {
unsafe {
*(x as *const i32 as *mut i32) = 7; //~ ERROR: only grants SharedReadOnly permission
*(x as *const i32 as *mut i32) = 7; //~ ERROR: /write access .* only grants SharedReadOnly permission/
}
}
2 changes: 1 addition & 1 deletion tests/fail/stacked_borrows/transmute-is-no-escape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ fn main() {
let _raw: *mut i32 = unsafe { mem::transmute(&mut x[0]) };
// `raw` still carries a tag, so we get another pointer to the same location that does not carry a tag
let raw = (&mut x[1] as *mut i32).wrapping_offset(-1);
unsafe { *raw = 13 }; //~ ERROR: borrow stack
unsafe { *raw = 13 }; //~ ERROR: /write access .* tag does not exist in the borrow stack/
}
Loading

0 comments on commit 8884ea4

Please sign in to comment.