Skip to content

Commit 55f8534

Browse files
committed
Don't retag the PtrMetadata(&raw const *_n) in slice indexing
1 parent faaabf4 commit 55f8534

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

tests/fail/both_borrows/buggy_as_mut_slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fn main() {
1313
let v1 = safe::as_mut_slice(&v);
1414
let v2 = safe::as_mut_slice(&v);
1515
v1[1] = 5;
16-
//~[stack]^ ERROR: /trying to retag .+ for SharedReadOnly permission .+ tag does not exist in the borrow stack for this location/
16+
//~[stack]^ ERROR: /write access .* tag does not exist in the borrow stack/
1717
v2[1] = 7;
1818
//~[tree]^ ERROR: /write access through .* is forbidden/
1919
}

tests/fail/both_borrows/buggy_as_mut_slice.stack.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
error: Undefined Behavior: trying to retag from <TAG> for SharedReadOnly permission at ALLOC[0x0], but that tag does not exist in the borrow stack for this location
1+
error: Undefined Behavior: attempting a write access using <TAG> at ALLOC[0x4], but that tag does not exist in the borrow stack for this location
22
--> tests/fail/both_borrows/buggy_as_mut_slice.rs:LL:CC
33
|
44
LL | v1[1] = 5;
5-
| ^^^^^
5+
| ^^^^^^^^^
66
| |
7-
| trying to retag from <TAG> for SharedReadOnly permission at ALLOC[0x0], but that tag does not exist in the borrow stack for this location
8-
| this error occurs as part of retag at ALLOC[0x0..0xc]
7+
| attempting a write access using <TAG> at ALLOC[0x4], but that tag does not exist in the borrow stack for this location
8+
| this error occurs as part of an access at ALLOC[0x4..0x8]
99
|
1010
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
1111
= help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information

0 commit comments

Comments
 (0)