-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-codegenArea: Code generationArea: Code generationC-bugCategory: This is a bug.Category: This is a bug.I-heavyIssue: Problems and improvements with respect to binary size of generated code.Issue: Problems and improvements with respect to binary size of generated code.I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
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
A-codegenArea: Code generationArea: Code generationC-bugCategory: This is a bug.Category: This is a bug.I-heavyIssue: Problems and improvements with respect to binary size of generated code.Issue: Problems and improvements with respect to binary size of generated code.I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.