Closed
Description
I tried this code:
pub struct BBox {
top: i32,
left: i32,
height: i32,
width: i32
}
fn fiddle(bbox: BBox) -> Box<BBox> {
Box::new(BBox {
top: bbox.top * 2,
..bbox
})
}
pub fn main() {
let bbox = Box::new(BBox {
top: 551,
left: 100,
height: 200,
width: 180,
});
let bbox = fiddle(*bbox);
let bbox_top = bbox.top;
println!("{}", bbox_top)
}
With rustc 1.60 all Box allocations are totally optimized out.
But starting from 1.61 it doesn't happen.
Possible it is the same issue as #97751
Metadata
Metadata
Assignees
Labels
Area: Code generationCategory: This is a bug.Issue: Problems and improvements with respect to binary size of generated code.Issue: Problems and improvements with respect to performance of generated code.Medium priorityRelevant to the compiler team, which will review and decide on the PR/issue.Performance or correctness regression from one stable version to another.