Test code:
#![feature(explicit_tail_calls)]
#![allow(incomplete_features)]
fn g(x: *const i32) {
let _val = unsafe { *x }; //~ERROR: has been freed, so this pointer is dangling
}
fn f(_x: *const i32) {
let local = 0;
let ptr = &local as *const i32;
become g(ptr)
}
fn main() {
f(std::ptr::null());
}
The deallocation span used to be
help: ALLOC was deallocated here:
--> tests/fail/tail_calls/dangling-local-var.rs:LL:CC
|
LL | f(std::ptr::null());
| ^^^^^^^^^^^^^^^^^^^
now it is
help: ALLOC was deallocated here:
--> tests/fail/tail_calls/dangling-local-var.rs:LL:CC
|
LL | let _val = unsafe { *x };
| ^^^^
Both of these make no sense. I think the ideal span would be to point at the become.