Skip to content

Commit 9c48688

Browse files
Rollup merge of #78847 - tmiasko:inline-return-place, r=matthewjasper
Assert that a return place is not used for indexing during integration The inliner integrates call destination place with callee return place by remapping the local and adding extra projections as necessary. If a call destination place contains any projections (which is already possible) and a return place is used in an indexing projection (most likely doesn't happen yet) the end result would be incorrect. Add an assertion to ensure that potential issue won't go unnoticed in the presence of more sophisticated copy propagation scheme.
2 parents 3a2cbe6 + 89c3582 commit 9c48688

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

compiler/rustc_mir/src/transform/inline.rs

+6
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,12 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Integrator<'a, 'tcx> {
729729
}
730730

731731
fn visit_place(&mut self, place: &mut Place<'tcx>, context: PlaceContext, location: Location) {
732+
for elem in place.projection {
733+
// FIXME: Make sure that return place is not used in an indexing projection, since it
734+
// won't be rebased as it is supposed to be.
735+
assert_ne!(ProjectionElem::Index(RETURN_PLACE), elem);
736+
}
737+
732738
// If this is the `RETURN_PLACE`, we need to rebase any projections onto it.
733739
let dest_proj_len = self.destination.projection.len();
734740
if place.local == RETURN_PLACE && dest_proj_len > 0 {

0 commit comments

Comments
 (0)