I found it confusing that &(*&a)
and &{*&a}
behave differently.
To be detailed, the following code failed to compile:
struct CanNotCopy;
fn main(){
let a = CanNotCopy;
&{*&a};
let c = a;
}
And the following code compiled:
struct CanNotCopy;
fn main(){
let a = CanNotCopy;
&(*&a); // or &*&a;
let c = a;
}
What is the semantical difference between the above codes?
Which are language constructs that lead to the transfer of ownership, precisely?