Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir/src/lib.rs')
| -rw-r--r-- | crates/hir/src/lib.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index d79e93406c..b088b5df1d 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -1574,6 +1574,11 @@ pub struct BuiltinType { } impl BuiltinType { + // FIXME: I'm not sure if it's the best place to put it + pub fn str() -> BuiltinType { + BuiltinType { inner: hir_def::builtin_type::BuiltinType::Str } + } + pub fn ty(self, db: &dyn HirDatabase, module: Module) -> Type { let resolver = module.id.resolver(db.upcast()); Type::new_with_resolver(db, &resolver, TyBuilder::builtin(self.inner)) @@ -2263,6 +2268,11 @@ impl Type { Type::new(db, krate, def, ty) } + // FIXME: No idea where to put it + pub fn make_slice_of(self) -> Type { + Type { krate: self.krate, env: self.env, ty: TyBuilder::slice(self.ty) } + } + pub fn is_unit(&self) -> bool { matches!(self.ty.kind(&Interner), TyKind::Tuple(0, ..)) } |