From 11a1f13cd1cf6da484fd4b8bfb5f72a625c2186a Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Mon, 1 Mar 2021 12:35:11 +0100 Subject: Being Ty::InferenceVar closes to chalk equivalent --- crates/hir_ty/src/lib.rs | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'crates/hir_ty/src/lib.rs') diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs index 1abb0440f..762437bf4 100644 --- a/crates/hir_ty/src/lib.rs +++ b/crates/hir_ty/src/lib.rs @@ -42,14 +42,14 @@ use crate::{ }; pub use autoderef::autoderef; -pub use infer::{InferTy, InferenceResult}; +pub use infer::{InferenceResult, InferenceVar}; pub use lower::{ associated_type_shorthand_candidates, callable_item_sig, CallableDefId, ImplTraitLoweringMode, TyDefId, TyLoweringContext, ValueTyDefId, }; pub use traits::{InEnvironment, Obligation, ProjectionPredicate, TraitEnvironment}; -pub use chalk_ir::{BoundVar, DebruijnIndex, Scalar}; +pub use chalk_ir::{BoundVar, DebruijnIndex, Scalar, TyVariableKind}; #[derive(Clone, PartialEq, Eq, Debug, Hash)] pub enum Lifetime { @@ -218,7 +218,7 @@ pub enum Ty { Bound(BoundVar), /// A type variable used during type checking. - Infer(InferTy), + InferenceVar(InferenceVar, TyVariableKind), /// A trait object (`dyn Trait` or bare `Trait` in pre-2018 Rust). /// @@ -527,22 +527,15 @@ impl TypeWalk for GenericPredicate { #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Canonical { pub value: T, - pub kinds: Arc<[TyKind]>, + pub kinds: Arc<[chalk_ir::TyVariableKind]>, } impl Canonical { - pub fn new(value: T, kinds: impl IntoIterator) -> Self { + pub fn new(value: T, kinds: impl IntoIterator) -> Self { Self { value, kinds: kinds.into_iter().collect() } } } -#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] -pub enum TyKind { - General, - Integer, - Float, -} - /// A function signature as seen by type inference: Several parameter types and /// one return type. #[derive(Clone, PartialEq, Eq, Debug)] -- cgit v1.2.3