Expand description
Struct-based class lowering.
A Python class lowers to a Rust struct plus an inherent impl block:
- Instance attributes become struct fields, inferred from the
self.attrassignments in__init__(from annotated parameters, literals, or construction of another known class). __init__lowers as an ordinary method taking&mut self, and a synthesizednew(...)constructor default-initializes the struct and runs it;ClassName(...)call sites lower toClassName::new(...)?.- Methods lower as inherent methods; the receiver is
&self, or&mut selfwhen the method stores throughself(directly or by calling another method of the class that does).
Unsupported class constructs — inheritance, class-level statements, attributes whose types can’t be inferred — are conversion-time errors, never silently dropped: lowering that diverges from Python must fail loudly.