1 use std::mem;
2 
safe(_x: &mut i32, _y: &i32)3 pub fn safe(_x: &mut i32, _y: &i32) {} //~ ERROR borrow stack
4 
main()5 fn main() {
6     let mut x = 0;
7     let xref = &mut x;
8     let xraw: *mut i32 = unsafe { mem::transmute_copy(&xref) };
9     let xshr = &*xref;
10     // transmute fn ptr around so that we can avoid retagging
11     let safe_raw: fn(x: *mut i32, y: *const i32) = unsafe {
12         mem::transmute::<fn(&mut i32, &i32), _>(safe)
13     };
14     safe_raw(xraw, xshr);
15 }
16