Skip to content

Commit 069f219

Browse files
authored
Rollup merge of #104891 - fee1-dead-contrib:escaping_bound_vars_docs, r=wesleywiser
Add documentation for `has_escaping_bound_vars` Thanks to `@BoxyUwU` for explaining this to me. Adding docs with a helpful link if people get confused.
2 parents 63ec33e + 815d370 commit 069f219

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

compiler/rustc_middle/src/ty/visit.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,18 @@ pub trait TypeVisitable<'tcx>: fmt::Debug + Clone {
7272
self.visit_with(&mut HasEscapingVarsVisitor { outer_index: binder }).is_break()
7373
}
7474

75-
/// Returns `true` if this `self` has any regions that escape `binder` (and
75+
/// Returns `true` if this type has any regions that escape `binder` (and
7676
/// hence are not bound by it).
7777
fn has_vars_bound_above(&self, binder: ty::DebruijnIndex) -> bool {
7878
self.has_vars_bound_at_or_above(binder.shifted_in(1))
7979
}
8080

81+
/// Return `true` if this type has regions that are not a part of the type.
82+
/// For example, `for<'a> fn(&'a i32)` return `false`, while `fn(&'a i32)`
83+
/// would return `true`. The latter can occur when traversing through the
84+
/// former.
85+
///
86+
/// See [`HasEscapingVarsVisitor`] for more information.
8187
fn has_escaping_bound_vars(&self) -> bool {
8288
self.has_vars_bound_at_or_above(ty::INNERMOST)
8389
}

0 commit comments

Comments
 (0)