File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
src/librustc_mir/borrow_check Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -11,10 +11,10 @@ use super::MirBorrowckCtxt;
1111
1212use rustc:: hir;
1313use rustc:: ty:: { self , TyCtxt } ;
14- use rustc:: mir:: { Mir , Place , ProjectionElem } ;
14+ use rustc:: mir:: { Mir , Place , NeoPlace , ProjectionElem } ;
1515
1616pub trait IsPrefixOf < ' tcx > {
17- fn is_prefix_of ( & self , other : & Place < ' tcx > ) -> bool ;
17+ fn is_prefix_of ( & self , other : & Self ) -> bool ;
1818}
1919
2020impl < ' tcx > IsPrefixOf < ' tcx > for Place < ' tcx > {
@@ -36,6 +36,17 @@ impl<'tcx> IsPrefixOf<'tcx> for Place<'tcx> {
3636 }
3737}
3838
39+ impl < ' tcx > IsPrefixOf < ' tcx > for NeoPlace < ' tcx > {
40+ fn is_prefix_of ( & self , other : & NeoPlace < ' tcx > ) -> bool {
41+ self . base == other. base
42+ && self . elems . len ( ) <= other. elems . len ( )
43+ && self
44+ . elems
45+ . iter ( )
46+ . zip ( other. elems )
47+ . all ( |( elem, other_elem) | elem == other_elem)
48+ }
49+ }
3950
4051pub ( super ) struct Prefixes < ' cx , ' gcx : ' tcx , ' tcx : ' cx > {
4152 mir : & ' cx Mir < ' tcx > ,
You can’t perform that action at this time.
0 commit comments