File tree 1 file changed +13
-2
lines changed
src/librustc_mir/borrow_check
1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -11,10 +11,10 @@ use super::MirBorrowckCtxt;
11
11
12
12
use rustc:: hir;
13
13
use rustc:: ty:: { self , TyCtxt } ;
14
- use rustc:: mir:: { Mir , Place , ProjectionElem } ;
14
+ use rustc:: mir:: { Mir , Place , NeoPlace , ProjectionElem } ;
15
15
16
16
pub trait IsPrefixOf < ' tcx > {
17
- fn is_prefix_of ( & self , other : & Place < ' tcx > ) -> bool ;
17
+ fn is_prefix_of ( & self , other : & Self ) -> bool ;
18
18
}
19
19
20
20
impl < ' tcx > IsPrefixOf < ' tcx > for Place < ' tcx > {
@@ -36,6 +36,17 @@ impl<'tcx> IsPrefixOf<'tcx> for Place<'tcx> {
36
36
}
37
37
}
38
38
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
+ }
39
50
40
51
pub ( super ) struct Prefixes < ' cx , ' gcx : ' tcx , ' tcx : ' cx > {
41
52
mir : & ' cx Mir < ' tcx > ,
You can’t perform that action at this time.
0 commit comments