More cleanups / module docs

This commit is contained in:
Florian Diebold 2021-04-09 14:39:07 +02:00
parent 8a2c482082
commit fbe98047d4
6 changed files with 12 additions and 10 deletions

View file

@ -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; use std::sync::Arc;

View file

@ -1,4 +1,4 @@
//! FIXME: write short doc here //! Type inference-based diagnostics.
mod expr; mod expr;
mod match_check; mod match_check;
mod unsafe_check; mod unsafe_check;

View file

@ -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::{ use std::{
array, array,

View file

@ -126,14 +126,14 @@ pub fn param_idx(db: &dyn HirDatabase, id: TypeParamId) -> Option<usize> {
generics(db.upcast(), id.parent).param_idx(id) generics(db.upcast(), id.parent).param_idx(id)
} }
pub fn wrap_empty_binders<T>(value: T) -> Binders<T> pub(crate) fn wrap_empty_binders<T>(value: T) -> Binders<T>
where where
T: Fold<Interner, Result = T> + HasInterner<Interner = Interner>, T: Fold<Interner, Result = T> + HasInterner<Interner = Interner>,
{ {
Binders::empty(&Interner, value.shifted_in_from(&Interner, DebruijnIndex::ONE)) Binders::empty(&Interner, value.shifted_in_from(&Interner, DebruijnIndex::ONE))
} }
pub fn make_only_type_binders<T: HasInterner<Interner = Interner>>( pub(crate) fn make_only_type_binders<T: HasInterner<Interner = Interner>>(
num_vars: usize, num_vars: usize,
value: T, value: T,
) -> Binders<T> { ) -> Binders<T> {

View file

@ -1,7 +1,4 @@
//! Defines primitive types, which have a couple of peculiarities: //! A few helper functions for dealing with primitives.
//!
//! * during type inference, they can be uncertain (ie, `let x = 92;`)
//! * they don't belong to any particular crate.
pub use chalk_ir::{FloatTy, IntTy, UintTy}; pub use chalk_ir::{FloatTy, IntTy, UintTy};
pub use hir_def::builtin_type::{BuiltinFloat, BuiltinInt, BuiltinUint}; pub use hir_def::builtin_type::{BuiltinFloat, BuiltinInt, BuiltinUint};

View file

@ -1,9 +1,11 @@
//! Trait solving using Chalk. //! Trait solving using Chalk.
use std::env::var; use std::env::var;
use base_db::CrateId;
use chalk_ir::cast::Cast; use chalk_ir::cast::Cast;
use chalk_solve::{logging_db::LoggingRustIrDatabase, Solver}; use chalk_solve::{logging_db::LoggingRustIrDatabase, Solver};
use base_db::CrateId;
use hir_def::{lang_item::LangItemTarget, TraitId}; use hir_def::{lang_item::LangItemTarget, TraitId};
use stdx::panic_context; use stdx::panic_context;