diff options
| author | Deadbeef <ent3rm4n@gmail.com> | 2022-11-25 15:02:53 +0000 |
|---|---|---|
| committer | Deadbeef <ent3rm4n@gmail.com> | 2022-11-25 15:02:53 +0000 |
| commit | 815d3703469194355d6fae6bc5844a1f7bbae4e1 (patch) | |
| tree | 90f94d219c1129f030658c00fe89cc0555c12b89 | |
| parent | 8a75c5a9b5d9c48aa576b08faf735b926d0d9a71 (diff) | |
| download | rust-815d3703469194355d6fae6bc5844a1f7bbae4e1.tar.gz rust-815d3703469194355d6fae6bc5844a1f7bbae4e1.zip | |
Add documentation for `has_escaping_bound_vars`
| -rw-r--r-- | compiler/rustc_middle/src/ty/visit.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/ty/visit.rs b/compiler/rustc_middle/src/ty/visit.rs index b04afe549ac..4cdfd9e5940 100644 --- a/compiler/rustc_middle/src/ty/visit.rs +++ b/compiler/rustc_middle/src/ty/visit.rs @@ -72,12 +72,18 @@ pub trait TypeVisitable<'tcx>: fmt::Debug + Clone { self.visit_with(&mut HasEscapingVarsVisitor { outer_index: binder }).is_break() } - /// Returns `true` if this `self` has any regions that escape `binder` (and + /// Returns `true` if this type has any regions that escape `binder` (and /// hence are not bound by it). fn has_vars_bound_above(&self, binder: ty::DebruijnIndex) -> bool { self.has_vars_bound_at_or_above(binder.shifted_in(1)) } + /// Return `true` if this type has regions that are not a part of the type. + /// For example, `for<'a> fn(&'a i32)` return `false`, while `fn(&'a i32)` + /// would return `true`. The latter can occur when traversing through the + /// former. + /// + /// See [`HasEscapingVarsVisitor`] for more information. fn has_escaping_bound_vars(&self) -> bool { self.has_vars_bound_at_or_above(ty::INNERMOST) } |
