diff options
| author | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2020-06-19 10:27:10 -0700 |
|---|---|---|
| committer | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2020-06-19 10:33:53 -0700 |
| commit | b2ec645d16ce9a3345b2f9cb527ca52e86e54324 (patch) | |
| tree | 751b47d1ad39a531b4345bf7cca0aa0c708fb06b | |
| parent | c178e6436a4c3f34b8790a908de044bba9401284 (diff) | |
| download | rust-b2ec645d16ce9a3345b2f9cb527ca52e86e54324.tar.gz rust-b2ec645d16ce9a3345b2f9cb527ca52e86e54324.zip | |
Incorporate review suggestions
Co-authored-by: Tyler Mandry <tmandry@gmail.com>
| -rw-r--r-- | src/librustc_mir/transform/generator.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index 9a15fba2bc8..59be8dc224d 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -1343,7 +1343,7 @@ impl<'tcx> MirPass<'tcx> for StateTransform { } /// Looks for any assignments between locals (e.g., `_4 = _5`) that will both be converted to fields -/// in the generator state machine but whose storage does not conflict. +/// in the generator state machine but whose storage is not marked as conflicting /// /// Validation needs to happen immediately *before* `TransformVisitor` is invoked, not after. /// @@ -1371,7 +1371,7 @@ impl EnsureGeneratorFieldAssignmentsNeverAlias<'_> { fn check_assigned_place(&mut self, place: Place<'tcx>, f: impl FnOnce(&mut Self)) { if let Some(assigned_local) = self.saved_local_for_direct_place(place) { - assert!(self.assigned_local.is_none(), "`check_assigned_local` must not recurse"); + assert!(self.assigned_local.is_none(), "`check_assigned_place` must not recurse"); self.assigned_local = Some(assigned_local); f(self); @@ -1385,7 +1385,10 @@ impl Visitor<'tcx> for EnsureGeneratorFieldAssignmentsNeverAlias<'_> { let lhs = match self.assigned_local { Some(l) => l, None => { - // We should be visiting all places used in the MIR. + // This visitor only invokes `visit_place` for the right-hand side of an assignment + // and only after setting `self.assigned_local`. However, the default impl of + // `Visitor::super_body` may call `visit_place` with a `NonUseContext` for places + // with debuginfo. Ignore them here. assert!(!context.is_use()); return; } @@ -1398,8 +1401,8 @@ impl Visitor<'tcx> for EnsureGeneratorFieldAssignmentsNeverAlias<'_> { if !self.storage_conflicts.contains(lhs, rhs) { bug!( - "Assignment between generator saved locals whose storage does not conflict: \ - {:?}: {:?} = {:?}", + "Assignment between generator saved locals whose storage is not \ + marked as conflicting: {:?}: {:?} = {:?}", location, lhs, rhs, |
