@@ -1343,7 +1343,7 @@ impl<'tcx> MirPass<'tcx> for StateTransform {
13431343}
13441344
13451345/// 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
13471347///
13481348/// Validation needs to happen immediately *before* `TransformVisitor` is invoked, not after.
13491349///
@@ -1371,7 +1371,7 @@ impl EnsureGeneratorFieldAssignmentsNeverAlias<'_> {
13711371
13721372 fn check_assigned_place ( & mut self , place : Place < ' tcx > , f : impl FnOnce ( & mut Self ) ) {
13731373 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" ) ;
13751375
13761376 self . assigned_local = Some ( assigned_local) ;
13771377 f ( self ) ;
@@ -1385,7 +1385,10 @@ impl Visitor<'tcx> for EnsureGeneratorFieldAssignmentsNeverAlias<'_> {
13851385 let lhs = match self . assigned_local {
13861386 Some ( l) => l,
13871387 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.
13891392 assert ! ( !context. is_use( ) ) ;
13901393 return ;
13911394 }
@@ -1398,8 +1401,8 @@ impl Visitor<'tcx> for EnsureGeneratorFieldAssignmentsNeverAlias<'_> {
13981401
13991402 if !self . storage_conflicts . contains ( lhs, rhs) {
14001403 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: {:?}: {:?} = {:?}",
14031406 location,
14041407 lhs,
14051408 rhs,
0 commit comments