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_hir as hir;
pub trait IsPrefixOf<'cx, 'tcx> {
fn is_prefix_of(&self, other: PlaceRef<'cx, 'tcx>) -> bool;
pub trait IsPrefixOf<'tcx> {
fn is_prefix_of(&self, other: PlaceRef<'tcx, 'tcx>) -> bool;
}
impl<'cx, 'tcx> IsPrefixOf<'cx, 'tcx> for PlaceRef<'cx, 'tcx> {
fn is_prefix_of(&self, other: PlaceRef<'cx, 'tcx>) -> bool {
impl<'tcx> IsPrefixOf<'tcx> for PlaceRef<'tcx, 'tcx> {
fn is_prefix_of(&self, other: PlaceRef<'tcx, 'tcx>) -> bool {
self.local == other.local
&& self.projection.len() <= other.projection.len()
&& self.projection == &other.projection[..self.projection.len()]