Skip to content

Commit e5bd01b

Browse files
committed
Correct comments.
1 parent 37e7f52 commit e5bd01b

File tree

2 files changed

+12
-13
lines changed
  • compiler
    • rustc_mir_dataflow/src/move_paths
    • rustc_mir_transform/src

2 files changed

+12
-13
lines changed

compiler/rustc_mir_dataflow/src/move_paths/mod.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
//! The move-analysis portion of borrowck needs to work in an abstract
2-
//! domain of lifted `Place`s. Most of the `Place` variants fall into a
3-
//! one-to-one mapping between the concrete and abstract (e.g., a
4-
//! field-deref on a local variable, `x.field`, has the same meaning
5-
//! in both domains). Indexed projections are the exception: `a[x]`
6-
//! needs to be treated as mapping to the same move path as `a[y]` as
7-
//! well as `a[13]`, etc. So we map these `x`/`y` values to `()`.
1+
//! The move-analysis portion of borrowck needs to work in an abstract domain of lifted `Place`s.
2+
//! Most of the `Place` variants fall into a one-to-one mapping between the concrete and abstract
3+
//! (e.g., a field projection on a local variable, `x.field`, has the same meaning in both
4+
//! domains). In other words, all field projections for the same field on the same local do not
5+
//! have meaningfully different types if ever. Indexed projections are the exception: `a[x]` needs
6+
//! to be treated as mapping to the same move path as `a[y]` as well as `a[13]`, etc. So we map
7+
//! these `x`/`y` values to `()`.
88
//!
9-
//! (In theory, the analysis could be extended to work with sets of
10-
//! paths, so that `a[0]` and `a[13]` could be kept distinct, while
11-
//! `a[x]` would still overlap them both. But that is not this
12-
//! representation does today.)
9+
//! (In theory, the analysis could be extended to work with sets of paths, so that `a[0]` and
10+
//! `a[13]` could be kept distinct, while `a[x]` would still overlap them both. But that is not
11+
//! what this representation does today.)
1312
1413
use std::fmt;
1514
use std::ops::{Index, IndexMut};

compiler/rustc_mir_transform/src/gvn.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
447447

448448
Projection(base, elem) => {
449449
let base = self.evaluated[base].as_ref()?;
450-
// `Index` by constants should have been replaces by `ConstantIndex` by
450+
// `Index` by constants should have been replaced by `ConstantIndex` by
451451
// `simplify_place_projection`.
452452
let elem = elem.try_map(|_| None, |()| ty.ty)?;
453453
self.ecx.project(base, elem).discard_err()?
@@ -460,7 +460,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
460460
let pointer = self.evaluated[local].as_ref()?;
461461
let mut mplace = self.ecx.deref_pointer(pointer).discard_err()?;
462462
for elem in place.projection.iter().skip(1) {
463-
// `Index` by constants should have been replaces by `ConstantIndex` by
463+
// `Index` by constants should have been replaced by `ConstantIndex` by
464464
// `simplify_place_projection`.
465465
let elem = elem.try_map(|_| None, |ty| ty)?;
466466
mplace = self.ecx.project(&mplace, elem).discard_err()?;

0 commit comments

Comments
 (0)