supranational / pasta-msm

High-performance Multi-scalar Multiplication for Pasta curves
Apache License 2.0
21 stars 11 forks source link

Upcoming compilation error (in rust nightly) #8

Closed huitseeker closed 1 year ago

huitseeker commented 1 year ago

See: https://github.com/rust-lang/rust/pull/111567

Benches also present this issue, but see tests (observed with rustc 1.72.0-nightly (2d0aa5768 2023-06-18)):

error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
  --> src/tests.rs:81:29
   |
81 | / ...                   *(&ret[work] as *const pallas::Scalar
82 | | ...                       as *mut pallas::Scalar) =
   | |_________________________________________________^
   |
   = note: `#[deny(cast_ref_to_mut)]` on by default

error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
   --> src/tests.rs:119:25
    |
119 | /                         *(&rets[tid.fetch_add(1, Ordering::Relaxed)]
120 | |                             as *const pallas::Point
121 | |                             as *mut pallas::Point) = ret
    | |__________________________________________________^

error: could not compile `pasta-msm` (lib test) due to 2 previous errors
dot-asm commented 1 year ago

Thanks! I'll look into it.