FuelLabs/sway

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

已关闭

#7,625 创建于 2026年5月12日

 (0 条评论) (0 个反应) (0 位负责人)Rust (5,421 个派生)batch import
bugformattergood first issueteam:tooling

仓库指标

星标
 (61,702 个星标)
PR 合并指标
 (平均合并 22小时 6分钟) (30 天内合并 16 个 PR)

描述

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

贡献者指南