Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir/src/term_search/tactics.rs')
-rw-r--r--crates/hir/src/term_search/tactics.rs25
1 files changed, 13 insertions, 12 deletions
diff --git a/crates/hir/src/term_search/tactics.rs b/crates/hir/src/term_search/tactics.rs
index c7ef4e5d5d..8700326e17 100644
--- a/crates/hir/src/term_search/tactics.rs
+++ b/crates/hir/src/term_search/tactics.rs
@@ -41,7 +41,7 @@ use super::{LookupTable, NewTypesKey, TermSearchCtx};
/// _Note that there is no use of calling this tactic in every iteration as the output does not
/// depend on the current state of `lookup`_
pub(super) fn trivial<'a, 'lt, 'db, DB: HirDatabase>(
- ctx: &'a TermSearchCtx<'db, DB>,
+ ctx: &'a TermSearchCtx<'_, 'db, DB>,
defs: &'a FxHashSet<ScopeDef>,
lookup: &'lt mut LookupTable<'db>,
) -> impl Iterator<Item = Expr<'db>> + use<'a, 'db, 'lt, DB> {
@@ -53,14 +53,15 @@ pub(super) fn trivial<'a, 'lt, 'db, DB: HirDatabase>(
ScopeDef::GenericParam(GenericParam::ConstParam(it)) => Some(Expr::ConstParam(*it)),
ScopeDef::Local(it) => {
if ctx.config.enable_borrowcheck {
- let borrowck = db.borrowck(it.parent.as_def_with_body()?).ok()?;
+ let borrowck = db.borrowck(it.parent_infer).ok()?;
let invalid = borrowck.iter().any(|b| {
+ let mir_body = b.mir_body(ctx.sema.db);
b.partially_moved.iter().any(|moved| {
- Some(&moved.local) == b.mir_body.binding_locals.get(it.binding_id)
+ Some(&moved.local) == mir_body.binding_locals.get(it.binding_id)
}) || b.borrow_regions.iter().any(|region| {
// Shared borrows are fine
- Some(&region.local) == b.mir_body.binding_locals.get(it.binding_id)
+ Some(&region.local) == mir_body.binding_locals.get(it.binding_id)
&& region.kind != BorrowKind::Shared
})
});
@@ -105,7 +106,7 @@ pub(super) fn trivial<'a, 'lt, 'db, DB: HirDatabase>(
/// _Note that there is no use of calling this tactic in every iteration as the output does not
/// depend on the current state of `lookup`_
pub(super) fn assoc_const<'a, 'lt, 'db, DB: HirDatabase>(
- ctx: &'a TermSearchCtx<'db, DB>,
+ ctx: &'a TermSearchCtx<'_, 'db, DB>,
defs: &'a FxHashSet<ScopeDef>,
lookup: &'lt mut LookupTable<'db>,
) -> impl Iterator<Item = Expr<'db>> + use<'a, 'db, 'lt, DB> {
@@ -153,7 +154,7 @@ pub(super) fn assoc_const<'a, 'lt, 'db, DB: HirDatabase>(
/// * `lookup` - Lookup table for types
/// * `should_continue` - Function that indicates when to stop iterating
pub(super) fn data_constructor<'a, 'lt, 'db, DB: HirDatabase>(
- ctx: &'a TermSearchCtx<'db, DB>,
+ ctx: &'a TermSearchCtx<'_, 'db, DB>,
_defs: &'a FxHashSet<ScopeDef>,
lookup: &'lt mut LookupTable<'db>,
should_continue: &'a dyn std::ops::Fn() -> bool,
@@ -302,7 +303,7 @@ pub(super) fn data_constructor<'a, 'lt, 'db, DB: HirDatabase>(
/// * `lookup` - Lookup table for types
/// * `should_continue` - Function that indicates when to stop iterating
pub(super) fn free_function<'a, 'lt, 'db, DB: HirDatabase>(
- ctx: &'a TermSearchCtx<'db, DB>,
+ ctx: &'a TermSearchCtx<'_, 'db, DB>,
defs: &'a FxHashSet<ScopeDef>,
lookup: &'lt mut LookupTable<'db>,
should_continue: &'a dyn std::ops::Fn() -> bool,
@@ -437,7 +438,7 @@ pub(super) fn free_function<'a, 'lt, 'db, DB: HirDatabase>(
/// * `lookup` - Lookup table for types
/// * `should_continue` - Function that indicates when to stop iterating
pub(super) fn impl_method<'a, 'lt, 'db, DB: HirDatabase>(
- ctx: &'a TermSearchCtx<'db, DB>,
+ ctx: &'a TermSearchCtx<'_, 'db, DB>,
_defs: &'a FxHashSet<ScopeDef>,
lookup: &'lt mut LookupTable<'db>,
should_continue: &'a dyn std::ops::Fn() -> bool,
@@ -556,7 +557,7 @@ pub(super) fn impl_method<'a, 'lt, 'db, DB: HirDatabase>(
/// * `lookup` - Lookup table for types
/// * `should_continue` - Function that indicates when to stop iterating
pub(super) fn struct_projection<'a, 'lt, 'db, DB: HirDatabase>(
- ctx: &'a TermSearchCtx<'db, DB>,
+ ctx: &'a TermSearchCtx<'_, 'db, DB>,
_defs: &'a FxHashSet<ScopeDef>,
lookup: &'lt mut LookupTable<'db>,
should_continue: &'a dyn std::ops::Fn() -> bool,
@@ -598,7 +599,7 @@ pub(super) fn struct_projection<'a, 'lt, 'db, DB: HirDatabase>(
/// * `defs` - Set of items in scope at term search target location
/// * `lookup` - Lookup table for types
pub(super) fn famous_types<'a, 'lt, 'db, DB: HirDatabase>(
- ctx: &'a TermSearchCtx<'db, DB>,
+ ctx: &'a TermSearchCtx<'_, 'db, DB>,
_defs: &'a FxHashSet<ScopeDef>,
lookup: &'lt mut LookupTable<'db>,
) -> impl Iterator<Item = Expr<'db>> + use<'a, 'db, 'lt, DB> {
@@ -632,7 +633,7 @@ pub(super) fn famous_types<'a, 'lt, 'db, DB: HirDatabase>(
/// * `lookup` - Lookup table for types
/// * `should_continue` - Function that indicates when to stop iterating
pub(super) fn impl_static_method<'a, 'lt, 'db, DB: HirDatabase>(
- ctx: &'a TermSearchCtx<'db, DB>,
+ ctx: &'a TermSearchCtx<'_, 'db, DB>,
_defs: &'a FxHashSet<ScopeDef>,
lookup: &'lt mut LookupTable<'db>,
should_continue: &'a dyn std::ops::Fn() -> bool,
@@ -738,7 +739,7 @@ pub(super) fn impl_static_method<'a, 'lt, 'db, DB: HirDatabase>(
/// * `lookup` - Lookup table for types
/// * `should_continue` - Function that indicates when to stop iterating
pub(super) fn make_tuple<'a, 'lt, 'db, DB: HirDatabase>(
- ctx: &'a TermSearchCtx<'db, DB>,
+ ctx: &'a TermSearchCtx<'_, 'db, DB>,
_defs: &'a FxHashSet<ScopeDef>,
lookup: &'lt mut LookupTable<'db>,
should_continue: &'a dyn std::ops::Fn() -> bool,