You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When upgrading nightly Rust1, a new build error2 surfaced:
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
--> rust/spoof1/src/lib.rs:27:9
|
27 | std::ptr::write_volatile(owner_addr as *mut [u8; 32], fake_system.owner.to_bytes());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
= note: `#[deny(invalid_reference_casting)]` on by default
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
--> rust/spoof1/src/lib.rs:49:9
|
49 | std::ptr::write_volatile(owner_addr as *mut [u8; 32], tmp_native_owner);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: could not compile `solana-sbf-rust-spoof1` (lib) due to 2 previous errors
When looking at the original PR that added the spoof tests3, it was unclear to me what the original intent of the tests was, and thus unclear what the obvious fix should be.
Problem
When upgrading nightly Rust1, a new build error2 surfaced:
When looking at the original PR that added the spoof tests3, it was unclear to me what the original intent of the tests was, and thus unclear what the obvious fix should be.
Proposed Solution
Fix the undefined behavior.
Footnotes
https://github.com/solana-labs/solana/pull/34673 ↩
https://buildkite.com/solana-labs/solana/builds/106384#018ce951-65cf-43cf-b89d-ab17ff8a3618 ↩
https://github.com/solana-labs/solana/pull/13866 ↩
The text was updated successfully, but these errors were encountered: