alloy-rs / alloy-rs/ruint

`support/borsh`: Replace the unsafety with `generic_const_exprs` when

Aberta
#418 0 comentários 0 reações 1 responsável Reivindicada por @prestwich Ver no GitHub
to do tracker
Linguagem predominante
Rust
Estrelas
225
Forks
70
Merge médio
16h 54min
PRs com merge (30d)
8

Descrição

*On 2024-12-24 @prestwich wrote in [`e94bb80`](https://github.com/recmo/uint/commit/e94bb80ddce120329c21a8c21cbec8a25c79b6bf) “Merge pull request #416 from rtrombone/borsh”:*

Replace the unsafety with `generic_const_exprs` when
available

```rust
fn deserialize_reader(reader: &mut R) -> io::Result {
// This is a bit of an end-run around missing `generic_const_exprs`
// We cannot declare a `[u8; Self::BYTES]` or `[u8; LIMBS * 8]`,
// so we declare a `[u8; LIMBS]` and use unsafe to write to it.

// TODO: Replace the unsafety with `generic_const_exprs` when
// available
let mut limbs = [0u64; LIMBS];

// SAFETY: `limbs` is known to have identical memory layout and
// alignment to `[u8; LIMBS * 8]`, which is guaranteed to safely
// contain [u8; Self::BYTES]`, as `LIMBS * 8 >= Self::BYTES`.

```
*From [`src/support/borsh.rs:16`](https://github.com/recmo/uint/blob/e94bb80ddce120329c21a8c21cbec8a25c79b6bf/src/support/borsh.rs#L16)*

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.