Correct comments.
This commit is contained in:
@@ -1,15 +1,14 @@
|
|||||||
//! The move-analysis portion of borrowck needs to work in an abstract
|
//! The move-analysis portion of borrowck needs to work in an abstract domain of lifted `Place`s.
|
||||||
//! domain of lifted `Place`s. Most of the `Place` variants fall into a
|
//! Most of the `Place` variants fall into a one-to-one mapping between the concrete and abstract
|
||||||
//! one-to-one mapping between the concrete and abstract (e.g., a
|
//! (e.g., a field projection on a local variable, `x.field`, has the same meaning in both
|
||||||
//! field-deref on a local variable, `x.field`, has the same meaning
|
//! domains). In other words, all field projections for the same field on the same local do not
|
||||||
//! in both domains). Indexed projections are the exception: `a[x]`
|
//! have meaningfully different types if ever. Indexed projections are the exception: `a[x]` needs
|
||||||
//! needs to be treated as mapping to the same move path as `a[y]` as
|
//! to be treated as mapping to the same move path as `a[y]` as well as `a[13]`, etc. So we map
|
||||||
//! well as `a[13]`, etc. So we map these `x`/`y` values to `()`.
|
//! these `x`/`y` values to `()`.
|
||||||
//!
|
//!
|
||||||
//! (In theory, the analysis could be extended to work with sets of
|
//! (In theory, the analysis could be extended to work with sets of paths, so that `a[0]` and
|
||||||
//! paths, so that `a[0]` and `a[13]` could be kept distinct, while
|
//! `a[13]` could be kept distinct, while `a[x]` would still overlap them both. But that is not
|
||||||
//! `a[x]` would still overlap them both. But that is not this
|
//! what this representation does today.)
|
||||||
//! representation does today.)
|
|
||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::ops::{Index, IndexMut};
|
use std::ops::{Index, IndexMut};
|
||||||
|
|||||||
@@ -447,7 +447,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
|
|||||||
|
|
||||||
Projection(base, elem) => {
|
Projection(base, elem) => {
|
||||||
let base = self.evaluated[base].as_ref()?;
|
let base = self.evaluated[base].as_ref()?;
|
||||||
// `Index` by constants should have been replaces by `ConstantIndex` by
|
// `Index` by constants should have been replaced by `ConstantIndex` by
|
||||||
// `simplify_place_projection`.
|
// `simplify_place_projection`.
|
||||||
let elem = elem.try_map(|_| None, |()| ty.ty)?;
|
let elem = elem.try_map(|_| None, |()| ty.ty)?;
|
||||||
self.ecx.project(base, elem).discard_err()?
|
self.ecx.project(base, elem).discard_err()?
|
||||||
@@ -460,7 +460,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
|
|||||||
let pointer = self.evaluated[local].as_ref()?;
|
let pointer = self.evaluated[local].as_ref()?;
|
||||||
let mut mplace = self.ecx.deref_pointer(pointer).discard_err()?;
|
let mut mplace = self.ecx.deref_pointer(pointer).discard_err()?;
|
||||||
for elem in place.projection.iter().skip(1) {
|
for elem in place.projection.iter().skip(1) {
|
||||||
// `Index` by constants should have been replaces by `ConstantIndex` by
|
// `Index` by constants should have been replaced by `ConstantIndex` by
|
||||||
// `simplify_place_projection`.
|
// `simplify_place_projection`.
|
||||||
let elem = elem.try_map(|_| None, |ty| ty)?;
|
let elem = elem.try_map(|_| None, |ty| ty)?;
|
||||||
mplace = self.ecx.project(&mplace, elem).discard_err()?;
|
mplace = self.ecx.project(&mplace, elem).discard_err()?;
|
||||||
|
|||||||
Reference in New Issue
Block a user