diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2015-08-12 15:03:19 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2015-08-12 17:58:58 -0400 |
| commit | ad700abea4c6718628a4ceccccdad6a633f1dd9c (patch) | |
| tree | 3e5f50afa29fcb87f0b3bb7d570ff4e802b88cd3 | |
| parent | fda9b8396057426e86409fd75c69d896b05c372e (diff) | |
| download | rust-ad700abea4c6718628a4ceccccdad6a633f1dd9c.tar.gz rust-ad700abea4c6718628a4ceccccdad6a633f1dd9c.zip | |
ty.rs: document/cleanup required_region_bounds a bit
| -rw-r--r-- | src/librustc/middle/ty.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 9ccfce8d304..49bf0e580b9 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -6233,13 +6233,18 @@ impl<'tcx> ctxt<'tcx> { /// themselves. This should really be a unique type; `FreshTy(0)` is a /// popular choice. /// + /// NB: in some cases, particularly around higher-ranked bounds, + /// this function returns a kind of conservative approximation. + /// That is, all regions returned by this function are definitely + /// required, but there may be other region bounds that are not + /// returned, as well as requirements like `for<'a> T: 'a`. + /// /// Requires that trait definitions have been processed so that we can /// elaborate predicates and walk supertraits. pub fn required_region_bounds(&self, erased_self_ty: Ty<'tcx>, predicates: Vec<ty::Predicate<'tcx>>) - -> Vec<ty::Region> - { + -> Vec<ty::Region> { debug!("required_region_bounds(erased_self_ty={:?}, predicates={:?})", erased_self_ty, predicates); @@ -6268,11 +6273,7 @@ impl<'tcx> ctxt<'tcx> { // construct such an object, but this seems // correct even if that code changes). if t == erased_self_ty && !r.has_escaping_regions() { - if r.has_escaping_regions() { - Some(ty::ReStatic) - } else { - Some(r) - } + Some(r) } else { None } |
