Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/mir/borrowck.rs')
| -rw-r--r-- | crates/hir-ty/src/mir/borrowck.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/crates/hir-ty/src/mir/borrowck.rs b/crates/hir-ty/src/mir/borrowck.rs index 01892657bc..031654a259 100644 --- a/crates/hir-ty/src/mir/borrowck.rs +++ b/crates/hir-ty/src/mir/borrowck.rs @@ -12,12 +12,12 @@ use stdx::never; use triomphe::Arc; use crate::{ - TraitEnvironment, + InferenceResult, db::{HirDatabase, InternedClosure, InternedClosureId}, display::DisplayTarget, mir::OperandKind, next_solver::{ - DbInterner, GenericArgs, Ty, TypingMode, + DbInterner, GenericArgs, ParamEnv, Ty, TypingMode, infer::{DbInternerInferExt, InferCtxt}, }, }; @@ -97,7 +97,7 @@ pub fn borrowck_query<'db>( ) -> Result<Arc<[BorrowckResult<'db>]>, MirLowerError<'db>> { let _p = tracing::info_span!("borrowck_query").entered(); let module = def.module(db); - let interner = DbInterner::new_with(db, Some(module.krate()), module.containing_block()); + let interner = DbInterner::new_with(db, module.krate()); let env = db.trait_environment_for_body(def); let mut res = vec![]; // This calculates opaques defining scope which is a bit costly therefore is put outside `all_mir_bodies()`. @@ -107,8 +107,8 @@ pub fn borrowck_query<'db>( let infcx = interner.infer_ctxt().build(typing_mode); res.push(BorrowckResult { mutability_of_locals: mutability_of_locals(&infcx, &body), - moved_out_of_ref: moved_out_of_ref(&infcx, &env, &body), - partially_moved: partially_moved(&infcx, &env, &body), + moved_out_of_ref: moved_out_of_ref(&infcx, env, &body), + partially_moved: partially_moved(&infcx, env, &body), borrow_regions: borrow_regions(db, &body), mir_body: body, }); @@ -121,17 +121,17 @@ fn make_fetch_closure_field<'db>( ) -> impl FnOnce(InternedClosureId, GenericArgs<'db>, usize) -> Ty<'db> + use<'db> { |c: InternedClosureId, subst: GenericArgs<'db>, f: usize| { let InternedClosure(def, _) = db.lookup_intern_closure(c); - let infer = db.infer(def); + let infer = InferenceResult::for_body(db, def); let (captures, _) = infer.closure_info(c); let parent_subst = subst.split_closure_args_untupled().parent_args; - let interner = DbInterner::new_with(db, None, None); + let interner = DbInterner::new_no_crate(db); captures.get(f).expect("broken closure field").ty.instantiate(interner, parent_subst) } } fn moved_out_of_ref<'db>( infcx: &InferCtxt<'db>, - env: &TraitEnvironment<'db>, + env: ParamEnv<'db>, body: &MirBody<'db>, ) -> Vec<MovedOutOfRef<'db>> { let db = infcx.interner.db; @@ -152,7 +152,7 @@ fn moved_out_of_ref<'db>( ); } if is_dereference_of_ref - && !infcx.type_is_copy_modulo_regions(env.env, ty) + && !infcx.type_is_copy_modulo_regions(env, ty) && !ty.references_non_lt_error() { result.push(MovedOutOfRef { span: op.span.unwrap_or(span), ty }); @@ -231,7 +231,7 @@ fn moved_out_of_ref<'db>( fn partially_moved<'db>( infcx: &InferCtxt<'db>, - env: &TraitEnvironment<'db>, + env: ParamEnv<'db>, body: &MirBody<'db>, ) -> Vec<PartiallyMoved<'db>> { let db = infcx.interner.db; @@ -247,7 +247,7 @@ fn partially_moved<'db>( body.owner.module(db).krate(), ); } - if !infcx.type_is_copy_modulo_regions(env.env, ty) && !ty.references_non_lt_error() { + if !infcx.type_is_copy_modulo_regions(env, ty) && !ty.references_non_lt_error() { result.push(PartiallyMoved { span, ty, local: p.local }); } } |