From 8a2c4820821a9b266ed979ed9321431362cdb1b3 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Fri, 9 Apr 2021 14:33:03 +0200 Subject: More cleanups --- crates/hir_ty/src/chalk_cast.rs | 16 ---------------- crates/hir_ty/src/interner.rs | 9 +++++++++ crates/hir_ty/src/lib.rs | 42 ++++++++++++++++++++--------------------- 3 files changed, 29 insertions(+), 38 deletions(-) delete mode 100644 crates/hir_ty/src/chalk_cast.rs (limited to 'crates') diff --git a/crates/hir_ty/src/chalk_cast.rs b/crates/hir_ty/src/chalk_cast.rs deleted file mode 100644 index f27dee3fd..000000000 --- a/crates/hir_ty/src/chalk_cast.rs +++ /dev/null @@ -1,16 +0,0 @@ -//! Implementations of the Chalk `Cast` trait for our types. - -use chalk_ir::interner::HasInterner; - -use crate::{CallableSig, ReturnTypeImplTraits}; - -macro_rules! has_interner { - ($t:ty) => { - impl HasInterner for $t { - type Interner = crate::Interner; - } - }; -} - -has_interner!(CallableSig); -has_interner!(ReturnTypeImplTraits); diff --git a/crates/hir_ty/src/interner.rs b/crates/hir_ty/src/interner.rs index 02e26c04e..a1656115d 100644 --- a/crates/hir_ty/src/interner.rs +++ b/crates/hir_ty/src/interner.rs @@ -412,3 +412,12 @@ impl chalk_ir::interner::Interner for Interner { impl chalk_ir::interner::HasInterner for Interner { type Interner = Self; } + +#[macro_export] +macro_rules! has_interner { + ($t:ty) => { + impl HasInterner for $t { + type Interner = crate::Interner; + } + }; +} diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs index 6b5006f5d..ef1bdefac 100644 --- a/crates/hir_ty/src/lib.rs +++ b/crates/hir_ty/src/lib.rs @@ -7,25 +7,23 @@ macro_rules! eprintln { } mod autoderef; -pub mod primitive; -pub mod traits; -pub mod method_resolution; -mod op; -mod lower; -pub(crate) mod infer; -pub(crate) mod utils; -mod chalk_cast; -mod chalk_ext; mod builder; -mod walk; -mod tls; +mod chalk_db; +mod chalk_ext; +mod infer; mod interner; +mod lower; mod mapping; -mod chalk_db; - -pub mod display; +mod op; +mod tls; +mod utils; +mod walk; pub mod db; pub mod diagnostics; +pub mod display; +pub mod method_resolution; +pub mod primitive; +pub mod traits; #[cfg(test)] mod tests; @@ -100,6 +98,10 @@ pub type ConstValue = chalk_ir::ConstValue; pub type ConcreteConst = chalk_ir::ConcreteConst; pub type ChalkTraitId = chalk_ir::TraitId; +pub type TraitRef = chalk_ir::TraitRef; +pub type QuantifiedWhereClause = Binders; +pub type QuantifiedWhereClauses = chalk_ir::QuantifiedWhereClauses; +pub type Canonical = chalk_ir::Canonical; pub type FnSig = chalk_ir::FnSig; @@ -159,14 +161,6 @@ pub fn make_canonical>( Canonical { value, binders: chalk_ir::CanonicalVarKinds::from_iter(&Interner, kinds) } } -pub type TraitRef = chalk_ir::TraitRef; - -pub type QuantifiedWhereClause = Binders; - -pub type QuantifiedWhereClauses = chalk_ir::QuantifiedWhereClauses; - -pub type Canonical = chalk_ir::Canonical; - /// A function signature as seen by type inference: Several parameter types and /// one return type. #[derive(Clone, PartialEq, Eq, Debug)] @@ -175,6 +169,8 @@ pub struct CallableSig { is_varargs: bool, } +has_interner!(CallableSig); + /// A polymorphic function signature. pub type PolyFnSig = Binders; @@ -238,6 +234,8 @@ pub struct ReturnTypeImplTraits { pub(crate) impl_traits: Vec, } +has_interner!(ReturnTypeImplTraits); + #[derive(Clone, PartialEq, Eq, Debug, Hash)] pub(crate) struct ReturnTypeImplTrait { pub(crate) bounds: Binders>, -- cgit v1.2.3