about summary refs log tree commit diff
path: root/src/tools/miri/tests/fail/tree_borrows/reserved/cell-protected-write.stderr
blob: b1c3ffe86ef7fc3171cfe5555d1c62d1e30ed870 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
──────────────────────────────────────────────────
Warning: this tree is indicative only. Some tags may have been hidden.
0..   1
| Act |    └─┬──<TAG=root of the allocation>
| ReIM|      └─┬──<TAG=base>
| ReIM|        ├─┬──<TAG=x>
| ReIM|        │ └─┬──<TAG=caller:x>
| Res |        │   └────<TAG=callee:x> Strongly protected
| ReIM|        └────<TAG=y, callee:y, caller:y>
──────────────────────────────────────────────────
error: Undefined Behavior: write access through <TAG> (y, callee:y, caller:y) at ALLOC[0x0] is forbidden
  --> tests/fail/tree_borrows/reserved/cell-protected-write.rs:LL:CC
   |
LL |             *y = 1;
   |             ^^^^^^ Undefined Behavior occurred here
   |
   = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental
   = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/tree-borrows.md for further information
   = help: the accessed tag <TAG> (y, callee:y, caller:y) is foreign to the protected tag <TAG> (callee:x) (i.e., it is not a child)
   = help: this foreign write access would cause the protected tag <TAG> (callee:x) (currently Reserved) to become Disabled
   = help: protected tags must never be Disabled
help: the accessed tag <TAG> was created here
  --> tests/fail/tree_borrows/reserved/cell-protected-write.rs:LL:CC
   |
LL |         let y = (&mut *n) as *mut UnsafeCell<_> as *mut _;
   |                 ^^^^^^^^^
help: the protected tag <TAG> was created here, in the initial state Reserved
  --> tests/fail/tree_borrows/reserved/cell-protected-write.rs:LL:CC
   |
LL |         unsafe fn write_second(x: &mut UnsafeCell<u8>, y: *mut u8) {
   |                                ^
   = note: BACKTRACE (of the first span):
   = note: inside `main::write_second` at tests/fail/tree_borrows/reserved/cell-protected-write.rs:LL:CC
note: inside `main`
  --> tests/fail/tree_borrows/reserved/cell-protected-write.rs:LL:CC
   |
LL |         write_second(x, y);
   |         ^^^^^^^^^^^^^^^^^^

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

error: aborting due to 1 previous error