@@ -45,7 +45,6 @@ pub(super) fn convert_typeck_constraints<'tcx>(
4545 {
4646 localize_statement_constraint (
4747 tcx,
48- body,
4948 stmt,
5049 & outlives_constraint,
5150 point,
@@ -74,7 +73,6 @@ pub(super) fn convert_typeck_constraints<'tcx>(
7473/// needed CFG `from`-`to` intra-block nodes.
7574fn localize_statement_constraint < ' tcx > (
7675 tcx : TyCtxt < ' tcx > ,
77- body : & Body < ' tcx > ,
7876 stmt : & Statement < ' tcx > ,
7977 outlives_constraint : & OutlivesConstraint < ' tcx > ,
8078 current_point : PointIndex ,
@@ -114,28 +112,22 @@ fn localize_statement_constraint<'tcx>(
114112 } ,
115113 "there should be no common regions between the LHS and RHS of an assignment"
116114 ) ;
117-
118- let lhs_ty = body. local_decls [ lhs. local ] . ty ;
119- let successor_point = current_point;
120- compute_constraint_direction (
121- tcx,
122- outlives_constraint,
123- & lhs_ty,
124- current_point,
125- successor_point,
126- universal_regions,
127- )
128115 }
129116 _ => {
130- // For the other cases, we localize an outlives constraint to where it arises.
131- LocalizedOutlivesConstraint {
132- source : outlives_constraint. sup ,
133- from : current_point,
134- target : outlives_constraint. sub ,
135- to : current_point,
136- }
117+ // Assignments should be the only statement that can both generate constraints that
118+ // apply on entry (specific to the RHS place) *and* others that only apply on exit (the
119+ // subset of RHS regions that actually flow into the LHS): i.e., where midpoints would
120+ // be used to ensure the former happen before the latter, within the same MIR Location.
137121 }
138122 }
123+
124+ // We generally localize an outlives constraint to where it arises.
125+ LocalizedOutlivesConstraint {
126+ source : outlives_constraint. sup ,
127+ from : current_point,
128+ target : outlives_constraint. sub ,
129+ to : current_point,
130+ }
139131}
140132
141133/// For a given outlives constraint arising from a MIR terminator, localize the constraint with the
@@ -150,14 +142,12 @@ fn localize_terminator_constraint<'tcx>(
150142 universal_regions : & UniversalRegions < ' tcx > ,
151143) -> LocalizedOutlivesConstraint {
152144 // FIXME: check if other terminators need the same handling as `Call`s, in particular
153- // Assert/Yield/Drop. A handful of tests are failing with Drop related issues, as well as some
154- // coroutine tests, and that may be why.
145+ // Assert/Yield/Drop.
155146 match & terminator. kind {
156147 // FIXME: also handle diverging calls.
157148 TerminatorKind :: Call { destination, target : Some ( target) , .. } => {
158- // Calls are similar to assignments, and thus follow the same pattern. If there is a
159- // target for the call we also relate what flows into the destination here to entry to
160- // that successor.
149+ // If there is a target for the call we also relate what flows into the destination here
150+ // to entry to that successor.
161151 let destination_ty = destination. ty ( & body. local_decls , tcx) ;
162152 let successor_location = Location { block : * target, statement_index : 0 } ;
163153 let successor_point = liveness. point_from_location ( successor_location) ;
0 commit comments