From fbe98047d419ade6c87ccf432eb9534393d20020 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Fri, 9 Apr 2021 14:39:07 +0200 Subject: More cleanups / module docs --- crates/hir_ty/src/db.rs | 3 ++- crates/hir_ty/src/diagnostics.rs | 2 +- crates/hir_ty/src/display.rs | 4 +++- crates/hir_ty/src/lib.rs | 4 ++-- crates/hir_ty/src/primitive.rs | 5 +---- crates/hir_ty/src/traits.rs | 4 +++- 6 files changed, 12 insertions(+), 10 deletions(-) (limited to 'crates') diff --git a/crates/hir_ty/src/db.rs b/crates/hir_ty/src/db.rs index e11fc579e..1690926ad 100644 --- a/crates/hir_ty/src/db.rs +++ b/crates/hir_ty/src/db.rs @@ -1,4 +1,5 @@ -//! FIXME: write short doc here +//! The home of `HirDatabase`, which is the Salsa database containing all the +//! type inference-related queries. use std::sync::Arc; diff --git a/crates/hir_ty/src/diagnostics.rs b/crates/hir_ty/src/diagnostics.rs index 86f937e1d..84fc8ce14 100644 --- a/crates/hir_ty/src/diagnostics.rs +++ b/crates/hir_ty/src/diagnostics.rs @@ -1,4 +1,4 @@ -//! FIXME: write short doc here +//! Type inference-based diagnostics. mod expr; mod match_check; mod unsafe_check; diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs index ae3a82780..e7c9dabc2 100644 --- a/crates/hir_ty/src/display.rs +++ b/crates/hir_ty/src/display.rs @@ -1,4 +1,6 @@ -//! FIXME: write short doc here +//! The `HirDisplay` trait, which serves two purposes: Turning various bits from +//! HIR back into source code, and just displaying them for debugging/testing +//! purposes. use std::{ array, diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs index ef1bdefac..113234fa4 100644 --- a/crates/hir_ty/src/lib.rs +++ b/crates/hir_ty/src/lib.rs @@ -126,14 +126,14 @@ pub fn param_idx(db: &dyn HirDatabase, id: TypeParamId) -> Option { generics(db.upcast(), id.parent).param_idx(id) } -pub fn wrap_empty_binders(value: T) -> Binders +pub(crate) fn wrap_empty_binders(value: T) -> Binders where T: Fold + HasInterner, { Binders::empty(&Interner, value.shifted_in_from(&Interner, DebruijnIndex::ONE)) } -pub fn make_only_type_binders>( +pub(crate) fn make_only_type_binders>( num_vars: usize, value: T, ) -> Binders { diff --git a/crates/hir_ty/src/primitive.rs b/crates/hir_ty/src/primitive.rs index 2449addfb..d7f48c69a 100644 --- a/crates/hir_ty/src/primitive.rs +++ b/crates/hir_ty/src/primitive.rs @@ -1,7 +1,4 @@ -//! Defines primitive types, which have a couple of peculiarities: -//! -//! * during type inference, they can be uncertain (ie, `let x = 92;`) -//! * they don't belong to any particular crate. +//! A few helper functions for dealing with primitives. pub use chalk_ir::{FloatTy, IntTy, UintTy}; pub use hir_def::builtin_type::{BuiltinFloat, BuiltinInt, BuiltinUint}; diff --git a/crates/hir_ty/src/traits.rs b/crates/hir_ty/src/traits.rs index 7f77e421d..9936d0803 100644 --- a/crates/hir_ty/src/traits.rs +++ b/crates/hir_ty/src/traits.rs @@ -1,9 +1,11 @@ //! Trait solving using Chalk. + use std::env::var; -use base_db::CrateId; use chalk_ir::cast::Cast; use chalk_solve::{logging_db::LoggingRustIrDatabase, Solver}; + +use base_db::CrateId; use hir_def::{lang_item::LangItemTarget, TraitId}; use stdx::panic_context; -- cgit v1.2.3