]> git.lizzy.rs Git - rust.git/blob - tests/fail/stacked_borrows/invalidate_against_barrier2.stderr
Auto merge of #2229 - DrMeepster:patch-1, r=RalfJung
[rust.git] / tests / fail / stacked_borrows / invalidate_against_barrier2.stderr
1 error: Undefined Behavior: not granting access to tag <untagged> because incompatible item is protected: [SharedReadOnly for <TAG> (call ID)]
2   --> $DIR/invalidate_against_barrier2.rs:LL:CC
3    |
4 LL |     unsafe { *x = 0 };
5    |              ^^^^^^ not granting access to tag <untagged> because incompatible item is protected: [SharedReadOnly for <TAG> (call ID)]
6    |
7    = help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
8    = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
9 help: tag was most recently created at offsets [0x0..0x4]
10   --> $DIR/invalidate_against_barrier2.rs:LL:CC
11    |
12 LL |     let xraw = &mut x as *mut _;
13    |                ^^^^^^
14 help: <TAG> was protected due to a tag which was created here
15   --> $DIR/invalidate_against_barrier2.rs:LL:CC
16    |
17 LL |     inner(xraw, xref);
18    |                 ^^^^
19 help: this protector is live for this call
20   --> $DIR/invalidate_against_barrier2.rs:LL:CC
21    |
22 LL | / fn inner(x: *mut i32, _y: &i32) {
23 LL | |     // If `x` and `y` alias, retagging is fine with this... but we really
24 LL | |     // shouldn't be allowed to write to `x` at all because `y` was assumed to be
25 LL | |     // immutable for the duration of this call.
26 LL | |     unsafe { *x = 0 };
27 LL | | }
28    | |_^
29    = note: inside `inner` at $DIR/invalidate_against_barrier2.rs:LL:CC
30 note: inside `main` at $DIR/invalidate_against_barrier2.rs:LL:CC
31   --> $DIR/invalidate_against_barrier2.rs:LL:CC
32    |
33 LL |     inner(xraw, xref);
34    |     ^^^^^^^^^^^^^^^^^
35
36 note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
37
38 error: aborting due to previous error
39