Skip to content

Optimize structures with one element to transparent #9

@samsa1

Description

@samsa1

All structures with only one field should be unpacked. This would allow to produce faster code.

Location : in typed_rust after the lifetime analysis pass

Exemple :

struct MyNum {
     x : i32,
}

fn main() {
    let y = MyNum { x : 3 };
    
    let val = y.x;
}

The code above is equivalent to :

fn main() {
    let y = 3;
    let val = y;
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions