-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-mir-optArea: MIR optimizationsArea: MIR optimizationsA-mir-opt-nrvoFixed by the Named Return Value Opt. (NRVO)Fixed by the Named Return Value Opt. (NRVO)C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-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.
Description
#72205 will fail to fire for code such as the following:
fn foo(x: &mut i32) -> &i32 { x }
This is because, by the time we get to the RenameReturnPlace
pass, the reborrow has been optimized away and we have MIR like:
_0: &i32 = _1: &mut i32
To merge these locals, we need to pick a type for the unified LocalDecl
. However, I wasn't sure how or if codegen makes use of the types of locals, so for now #72205 just doesn't run if the locals have different type. We should come up with a solution here.
MSxDOS
Metadata
Metadata
Assignees
Labels
A-mir-optArea: MIR optimizationsArea: MIR optimizationsA-mir-opt-nrvoFixed by the Named Return Value Opt. (NRVO)Fixed by the Named Return Value Opt. (NRVO)C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-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.