rustc_mir_dataflow/move_paths/
abs_domain.rs
1use rustc_middle::mir::{PlaceElem, ProjectionElem, ProjectionKind};
15
16pub(crate) trait Lift {
17 fn lift(&self) -> ProjectionKind;
18}
19
20impl<'tcx> Lift for PlaceElem<'tcx> {
21 fn lift(&self) -> ProjectionKind {
22 match *self {
23 ProjectionElem::Deref => ProjectionElem::Deref,
24 ProjectionElem::Field(f, _ty) => ProjectionElem::Field(f, ()),
25 ProjectionElem::OpaqueCast(_ty) => ProjectionElem::OpaqueCast(()),
26 ProjectionElem::Index(_i) => ProjectionElem::Index(()),
27 ProjectionElem::Subslice { from, to, from_end } => {
28 ProjectionElem::Subslice { from, to, from_end }
29 }
30 ProjectionElem::ConstantIndex { offset, min_length, from_end } => {
31 ProjectionElem::ConstantIndex { offset, min_length, from_end }
32 }
33 ProjectionElem::Downcast(a, u) => ProjectionElem::Downcast(a, u),
34 ProjectionElem::Subtype(_ty) => ProjectionElem::Subtype(()),
35 ProjectionElem::UnwrapUnsafeBinder(_ty) => ProjectionElem::UnwrapUnsafeBinder(()),
36 }
37 }
38}