@@ -1343,7 +1343,7 @@ impl<'tcx> MirPass<'tcx> for StateTransform {
1343
1343
}
1344
1344
1345
1345
/// Looks for any assignments between locals (e.g., `_4 = _5`) that will both be converted to fields
1346
- /// in the generator state machine but whose storage does not conflict.
1346
+ /// in the generator state machine but whose storage is not marked as conflicting
1347
1347
///
1348
1348
/// Validation needs to happen immediately *before* `TransformVisitor` is invoked, not after.
1349
1349
///
@@ -1371,7 +1371,7 @@ impl EnsureGeneratorFieldAssignmentsNeverAlias<'_> {
1371
1371
1372
1372
fn check_assigned_place ( & mut self , place : Place < ' tcx > , f : impl FnOnce ( & mut Self ) ) {
1373
1373
if let Some ( assigned_local) = self . saved_local_for_direct_place ( place) {
1374
- assert ! ( self . assigned_local. is_none( ) , "`check_assigned_local ` must not recurse" ) ;
1374
+ assert ! ( self . assigned_local. is_none( ) , "`check_assigned_place ` must not recurse" ) ;
1375
1375
1376
1376
self . assigned_local = Some ( assigned_local) ;
1377
1377
f ( self ) ;
@@ -1385,7 +1385,10 @@ impl Visitor<'tcx> for EnsureGeneratorFieldAssignmentsNeverAlias<'_> {
1385
1385
let lhs = match self . assigned_local {
1386
1386
Some ( l) => l,
1387
1387
None => {
1388
- // We should be visiting all places used in the MIR.
1388
+ // This visitor only invokes `visit_place` for the right-hand side of an assignment
1389
+ // and only after setting `self.assigned_local`. However, the default impl of
1390
+ // `Visitor::super_body` may call `visit_place` with a `NonUseContext` for places
1391
+ // with debuginfo. Ignore them here.
1389
1392
assert ! ( !context. is_use( ) ) ;
1390
1393
return ;
1391
1394
}
@@ -1398,8 +1401,8 @@ impl Visitor<'tcx> for EnsureGeneratorFieldAssignmentsNeverAlias<'_> {
1398
1401
1399
1402
if !self . storage_conflicts . contains ( lhs, rhs) {
1400
1403
bug ! (
1401
- "Assignment between generator saved locals whose storage does not conflict: \
1402
- {:?}: {:?} = {:?}",
1404
+ "Assignment between generator saved locals whose storage is not \
1405
+ marked as conflicting: {:?}: {:?} = {:?}",
1403
1406
location,
1404
1407
lhs,
1405
1408
rhs,
0 commit comments