Closed maxwase closed 3 years ago
Jesus that's hideous ...
How is that even supposed to work, if I do
let mut a @ mut b @ c = 1;
b = 2;
dbg!(a);
It prints 1
, but aren't they meant to bind the same memory location?
...
I mean, ok, in line with the above this here doesn't compile:
struct S(u8);
let a @ b @ c = S(123);
So in a sense this doesn't really bind the underlying thing trice, but just creates 3 copies. This is probably the ugliest language concept I've come across but I like your example for outlining this weird behavior. I'd love if someone could sleuth a good (authoritative) link we can add for further reading.
Since Rust 1.56.0 you can run this code:
PR playground