Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/next_solver/interner.rs')
-rw-r--r--crates/hir-ty/src/next_solver/interner.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/hir-ty/src/next_solver/interner.rs b/crates/hir-ty/src/next_solver/interner.rs
index a3c984f6c9..a62835d9b0 100644
--- a/crates/hir-ty/src/next_solver/interner.rs
+++ b/crates/hir-ty/src/next_solver/interner.rs
@@ -288,12 +288,18 @@ impl<'db> DbInterner<'db> {
})
}
+ /// Creates a new interner without an active crate. Good only for interning things, not for trait solving etc..
+ /// As a rule of thumb, when you create an `InferCtxt`, you need to provide the crate (and the block).
+ pub fn new_no_crate(db: &'db dyn HirDatabase) -> Self {
+ DbInterner { db, krate: None, block: None }
+ }
+
pub fn new_with(
db: &'db dyn HirDatabase,
- krate: Option<Crate>,
+ krate: Crate,
block: Option<BlockId>,
) -> DbInterner<'db> {
- DbInterner { db, krate, block }
+ DbInterner { db, krate: Some(krate), block }
}
#[inline]