FuelLabs/sway

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

Open

#7625 opened on May 12, 2026

View on GitHub
 (0 comments) (0 reactions) (0 assignees)Rust (61,702 stars) (5,421 forks)batch import
bugformattergood first issueteam:tooling

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;
        };
    }
    }

Contributor guide