1
Fork 0

Make PlaceRef lifetimes of is_prefix_of be both 'tcx

This commit is contained in:
Santiago Pastorino 2020-03-04 18:13:47 -03:00
parent a32afa33c8
commit a5d1e189a1
No known key found for this signature in database
GPG key ID: 8131A24E0C79EFAF

View file

@ -13,12 +13,12 @@ use rustc::mir::{Place, PlaceRef, ProjectionElem, ReadOnlyBodyAndCache};
use rustc::ty::{self, TyCtxt}; use rustc::ty::{self, TyCtxt};
use rustc_hir as hir; use rustc_hir as hir;
pub trait IsPrefixOf<'cx, 'tcx> { pub trait IsPrefixOf<'tcx> {
fn is_prefix_of(&self, other: PlaceRef<'cx, 'tcx>) -> bool; fn is_prefix_of(&self, other: PlaceRef<'tcx, 'tcx>) -> bool;
} }
impl<'cx, 'tcx> IsPrefixOf<'cx, 'tcx> for PlaceRef<'cx, 'tcx> { impl<'tcx> IsPrefixOf<'tcx> for PlaceRef<'tcx, 'tcx> {
fn is_prefix_of(&self, other: PlaceRef<'cx, 'tcx>) -> bool { fn is_prefix_of(&self, other: PlaceRef<'tcx, 'tcx>) -> bool {
self.local == other.local self.local == other.local
&& self.projection.len() <= other.projection.len() && self.projection.len() <= other.projection.len()
&& self.projection == &other.projection[..self.projection.len()] && self.projection == &other.projection[..self.projection.len()]