Closed
Description
Miri reports UB in the new arc_from_vec_opt
test:
0.145300 test arc::arc_from_vec_opt ... error: Undefined Behavior: `ptr_offset_from` called on pointers into different allocations
0.000096 --> alloc_miri_test/../library/alloc/tests/arc.rs:222:13
0.000025 |
0.000018 222 | arc.as_ptr().cast::<u8>().offset_from(addr),
0.000016 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called on pointers into different allocations
0.000016 |
0.000016 = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
0.000016 = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
0.000016 = note: BACKTRACE:
0.000143 = note: inside `arc::arc_from_vec_opt` at alloc_miri_test/../library/alloc/tests/arc.rs:222:13
0.000020 note: inside closure at alloc_miri_test/../library/alloc/tests/arc.rs:215:23
0.000007 --> alloc_miri_test/../library/alloc/tests/arc.rs:215:23
0.000008 |
0.000007 214 | #[test]
0.000006 | ------- in this procedural macro expansion
0.000007 215 | fn arc_from_vec_opt() {
0.000007 | ^
On first sight, the error seems legitimate.
That test got added in #104205.
Cc @clubby789
Metadata
Metadata
Assignees
Labels
No labels