S0140: repr attribute is only valid on type and enum definitions
Generated from rellum-diagnostics/src/db.rs.
Explanation
#[repr] controls memory layout. Only type and enum definitions have a layout in the Rellum type system; functions and reactive bindings do not.
Common causes
- putting
#[repr(C)]on a function - putting
#[repr(C)]on a value or effect binding - using repr as a general metadata attribute instead of a layout attribute
Canonical fixes
- move
#[repr(C)]to the type whose layout matters
Before:
#[repr(C)]
make_point() : Point = Point { x: 0.0, y: 0.0 }
After:
#[repr(C)]
type Point = { x: Float, y: Float }
- remove
#[repr]from non-type items
Code example
#[repr(C)]
make_point() : Point = Point { x: 0.0, y: 0.0 }