Skip to content

Commit 0e45fe2

Browse files
committed
Actually keep PlaceMention if requested.
1 parent ec3178a commit 0e45fe2

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ pub const MIRI_DEFAULT_ARGS: &[&str] = &[
130130
"-Zalways-encode-mir",
131131
"-Zextra-const-ub-checks",
132132
"-Zmir-emit-retag",
133+
"-Zmir-keep-place-mention",
133134
"-Zmir-opt-level=0",
134135
"-Zmir-enable-passes=-CheckAlignment",
135136
];

tests/fail/dangling_pointers/dangling_pointer_deref_underscore.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ fn main() {
66
let b = Box::new(42);
77
&*b as *const i32
88
};
9-
let _ = unsafe { *p }; //~ ERROR: dereferenced after this allocation got freed
9+
unsafe {
10+
let _ = *p; //~ ERROR: dereferenced after this allocation got freed
11+
}
1012
panic!("this should never print");
1113
}

tests/fail/dangling_pointers/dangling_pointer_deref_underscore.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: Undefined Behavior: pointer to ALLOC was dereferenced after this allocation got freed
22
--> $DIR/dangling_pointer_deref_underscore.rs:LL:CC
33
|
4-
LL | let _ = unsafe { *p };
5-
| ^^ pointer to ALLOC was dereferenced after this allocation got freed
4+
LL | let _ = *p;
5+
| ^^ pointer to ALLOC was dereferenced after this allocation got freed
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

0 commit comments

Comments
 (0)