FuelLabs/sway

`forc-fmt` issue on `raw_ptr::write`.

Open

#7.625 aberto em 12 de mai. de 2026

Ver no GitHub
 (0 comments) (0 reactions) (0 assignees)Rust (5.421 forks)batch import
bugformattergood first issueteam:tooling

Métricas do repositório

Stars
 (61.702 stars)
Métricas de merge de PR
 (Mesclagem média 5d 4h) (19 fundiu PRs em 30d)

Description

To see the bug in practice see https://github.com/FuelLabs/sway/pull/7620

pub fn write<T>(self, val: T) {
        if __size_of::<T>() == 0 {    } else if __is_reference_type::<T>() {   // <---- look here how strange it is
        asm(dst: self, src: val, count: __size_of_val(val)) {
            mcp dst src count;
        };
    } else if __size_of::<T>() == 1 {
        asm(ptr: self, val: val) {
            sb ptr val i0;
        };
    } else {
        asm(ptr: self, val: val) {
            sw ptr val i0;
        };
    }
    }

Guia do colaborador