Skip to content

Commit

Permalink
use RegionEscape instead of inherent has_escaping_regions fns
Browse files Browse the repository at this point in the history
  • Loading branch information
arielb1 committed Sep 14, 2015
1 parent 5a95acb commit 3dc780e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
16 changes: 0 additions & 16 deletions src/librustc/middle/ty/mod.rs
Expand Up @@ -979,18 +979,6 @@ impl<'tcx> Predicate<'tcx> {
vec.into_iter()
}

pub fn has_escaping_regions(&self) -> bool {
match *self {
Predicate::Trait(ref trait_ref) => trait_ref.has_escaping_regions(),
Predicate::Equate(ref p) => p.has_escaping_regions(),
Predicate::RegionOutlives(ref p) => p.has_escaping_regions(),
Predicate::TypeOutlives(ref p) => p.has_escaping_regions(),
Predicate::Projection(ref p) => p.has_escaping_regions(),
Predicate::WellFormed(p) => p.has_escaping_regions(),
Predicate::ObjectSafe(_trait_def_id) => false,
}
}

pub fn to_opt_poly_trait_ref(&self) -> Option<PolyTraitRef<'tcx>> {
match *self {
Predicate::Trait(ref t) => {
Expand Down Expand Up @@ -1037,10 +1025,6 @@ impl<'tcx> InstantiatedPredicates<'tcx> {
InstantiatedPredicates { predicates: VecPerParamSpace::empty() }
}

pub fn has_escaping_regions(&self) -> bool {
self.predicates.any(|p| p.has_escaping_regions())
}

pub fn is_empty(&self) -> bool {
self.predicates.is_empty()
}
Expand Down
6 changes: 6 additions & 0 deletions src/librustc/middle/ty/structural_impls.rs
Expand Up @@ -45,6 +45,12 @@ impl<'tcx> RegionEscape for ty::ExistentialBounds<'tcx> {
}
}

impl<'tcx> RegionEscape for ty::InstantiatedPredicates<'tcx> {
fn has_regions_escaping_depth(&self, depth: u32) -> bool {
self.predicates.has_regions_escaping_depth(depth)
}
}

impl<'tcx> RegionEscape for subst::Substs<'tcx> {
fn has_regions_escaping_depth(&self, depth: u32) -> bool {
self.types.has_regions_escaping_depth(depth) ||
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/check/method/mod.rs
Expand Up @@ -17,7 +17,7 @@ use middle::def_id::DefId;
use middle::privacy::{AllPublic, DependsOn, LastPrivate, LastMod};
use middle::subst;
use middle::traits;
use middle::ty::{self, ToPredicate, ToPolyTraitRef, TraitRef};
use middle::ty::{self, RegionEscape, ToPredicate, ToPolyTraitRef, TraitRef};
use middle::ty::adjustment::{AdjustDerefRef, AutoDerefRef, AutoPtr};
use middle::infer;

Expand Down

0 comments on commit 3dc780e

Please sign in to comment.