yuewuo / fusion-blossom

A fast minimum-weight perfect matching solver for quantum error correction
MIT License
64 stars 16 forks source link

pointers: replace casts from `&T` to `&mut T` with unsafe cells #38

Closed atomgardner closed 6 months ago

atomgardner commented 6 months ago

Casting between immutable and mutable references can create undefined behaviour. Performing the cast through an UnsafeCell ensures noalias attributes are not being sent to LLVM.

closes: #36

yuewuo commented 6 months ago

Thanks, it works! Now it compiles on the latest stable toolchain.