I was playing around with pointers and references in Rust and noticed you can create a pointer-to-pointer or reference-to-reference in a single expression:
let i = 0;
let irr = &(&i);
let ipp: *const *const i32 = &(&i as *const i32);
If I was to try something similar in C, I would get a compile error because the 'addressof' operator returns an rvalue which doesn't have a storage location so cannot be pointed to:
int i = 0;
int *ip = &i;
int **ipp = &ip;
int **ipp = &(&i); /* error: cannot take the address of an rvalue of type 'int *' */
How does Rust deal with the intermediate pointer/reference? Does it silently put it on the stack or is there some other magic going on?