aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/lib.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-03-01 12:57:26 +0000
committerGitHub <[email protected]>2021-03-01 12:57:26 +0000
commitcda13d54613006c7985da0489878605300ba05b8 (patch)
tree81a8fc4b890192c41f00f7731929e781c3cb790a /crates/hir_ty/src/lib.rs
parent1c7b2b8c0748c9548500d0dc08c8da1d1a36c81a (diff)
parent4b7fc693150f333cefe0e69d93271807f32741c4 (diff)
Merge #7823
7823: Being Ty::InferenceVar closer to chalk equivalent r=flodiebold a=Veykril Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/lib.rs')
-rw-r--r--crates/hir_ty/src/lib.rs17
1 files changed, 5 insertions, 12 deletions
diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs
index 1abb0440f..1131eaf92 100644
--- a/crates/hir_ty/src/lib.rs
+++ b/crates/hir_ty/src/lib.rs
@@ -42,14 +42,14 @@ use crate::{
42}; 42};
43 43
44pub use autoderef::autoderef; 44pub use autoderef::autoderef;
45pub use infer::{InferTy, InferenceResult}; 45pub use infer::{InferenceResult, InferenceVar};
46pub use lower::{ 46pub use lower::{
47 associated_type_shorthand_candidates, callable_item_sig, CallableDefId, ImplTraitLoweringMode, 47 associated_type_shorthand_candidates, callable_item_sig, CallableDefId, ImplTraitLoweringMode,
48 TyDefId, TyLoweringContext, ValueTyDefId, 48 TyDefId, TyLoweringContext, ValueTyDefId,
49}; 49};
50pub use traits::{InEnvironment, Obligation, ProjectionPredicate, TraitEnvironment}; 50pub use traits::{InEnvironment, Obligation, ProjectionPredicate, TraitEnvironment};
51 51
52pub use chalk_ir::{BoundVar, DebruijnIndex, Scalar}; 52pub use chalk_ir::{BoundVar, DebruijnIndex, Scalar, TyVariableKind};
53 53
54#[derive(Clone, PartialEq, Eq, Debug, Hash)] 54#[derive(Clone, PartialEq, Eq, Debug, Hash)]
55pub enum Lifetime { 55pub enum Lifetime {
@@ -218,7 +218,7 @@ pub enum Ty {
218 Bound(BoundVar), 218 Bound(BoundVar),
219 219
220 /// A type variable used during type checking. 220 /// A type variable used during type checking.
221 Infer(InferTy), 221 InferenceVar(InferenceVar, TyVariableKind),
222 222
223 /// A trait object (`dyn Trait` or bare `Trait` in pre-2018 Rust). 223 /// A trait object (`dyn Trait` or bare `Trait` in pre-2018 Rust).
224 /// 224 ///
@@ -527,22 +527,15 @@ impl TypeWalk for GenericPredicate {
527#[derive(Debug, Clone, PartialEq, Eq, Hash)] 527#[derive(Debug, Clone, PartialEq, Eq, Hash)]
528pub struct Canonical<T> { 528pub struct Canonical<T> {
529 pub value: T, 529 pub value: T,
530 pub kinds: Arc<[TyKind]>, 530 pub kinds: Arc<[TyVariableKind]>,
531} 531}
532 532
533impl<T> Canonical<T> { 533impl<T> Canonical<T> {
534 pub fn new(value: T, kinds: impl IntoIterator<Item = TyKind>) -> Self { 534 pub fn new(value: T, kinds: impl IntoIterator<Item = TyVariableKind>) -> Self {
535 Self { value, kinds: kinds.into_iter().collect() } 535 Self { value, kinds: kinds.into_iter().collect() }
536 } 536 }
537} 537}
538 538
539#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
540pub enum TyKind {
541 General,
542 Integer,
543 Float,
544}
545
546/// A function signature as seen by type inference: Several parameter types and 539/// A function signature as seen by type inference: Several parameter types and
547/// one return type. 540/// one return type.
548#[derive(Clone, PartialEq, Eq, Debug)] 541#[derive(Clone, PartialEq, Eq, Debug)]