Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/next_solver/fold.rs')
| -rw-r--r-- | crates/hir-ty/src/next_solver/fold.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/crates/hir-ty/src/next_solver/fold.rs b/crates/hir-ty/src/next_solver/fold.rs index af823aa005..0a41874374 100644 --- a/crates/hir-ty/src/next_solver/fold.rs +++ b/crates/hir-ty/src/next_solver/fold.rs @@ -8,7 +8,8 @@ use rustc_type_ir::{ use crate::next_solver::{BoundConst, FxIndexMap}; use super::{ - Binder, BoundRegion, BoundTy, Const, ConstKind, DbInterner, Predicate, Region, Ty, TyKind, + Binder, BoundRegion, BoundTy, Const, ConstKind, DbInterner, Predicate, Region, SolverDefId, Ty, + TyKind, }; /// A delegate used when instantiating bound vars. @@ -219,4 +220,19 @@ impl<'db> DbInterner<'db> { { self.instantiate_bound_regions(value, |_| Region::new_erased(self)).0 } + + /// Replaces any late-bound regions bound in `value` with + /// free variants attached to `all_outlive_scope`. + pub fn liberate_late_bound_regions<T>( + self, + all_outlive_scope: SolverDefId, + value: Binder<'db, T>, + ) -> T + where + T: TypeFoldable<DbInterner<'db>>, + { + self.instantiate_bound_regions_uncached(value, |br| { + Region::new_late_param(self, all_outlive_scope, br) + }) + } } |