Skip to content

Commit ad700ab

Browse files
committed
ty.rs: document/cleanup required_region_bounds a bit
1 parent fda9b83 commit ad700ab

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/librustc/middle/ty.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6233,13 +6233,18 @@ impl<'tcx> ctxt<'tcx> {
62336233
/// themselves. This should really be a unique type; `FreshTy(0)` is a
62346234
/// popular choice.
62356235
///
6236+
/// NB: in some cases, particularly around higher-ranked bounds,
6237+
/// this function returns a kind of conservative approximation.
6238+
/// That is, all regions returned by this function are definitely
6239+
/// required, but there may be other region bounds that are not
6240+
/// returned, as well as requirements like `for<'a> T: 'a`.
6241+
///
62366242
/// Requires that trait definitions have been processed so that we can
62376243
/// elaborate predicates and walk supertraits.
62386244
pub fn required_region_bounds(&self,
62396245
erased_self_ty: Ty<'tcx>,
62406246
predicates: Vec<ty::Predicate<'tcx>>)
6241-
-> Vec<ty::Region>
6242-
{
6247+
-> Vec<ty::Region> {
62436248
debug!("required_region_bounds(erased_self_ty={:?}, predicates={:?})",
62446249
erased_self_ty,
62456250
predicates);
@@ -6268,11 +6273,7 @@ impl<'tcx> ctxt<'tcx> {
62686273
// construct such an object, but this seems
62696274
// correct even if that code changes).
62706275
if t == erased_self_ty && !r.has_escaping_regions() {
6271-
if r.has_escaping_regions() {
6272-
Some(ty::ReStatic)
6273-
} else {
6274-
Some(r)
6275-
}
6276+
Some(r)
62766277
} else {
62776278
None
62786279
}

0 commit comments

Comments
 (0)