diff options
Diffstat (limited to 'crates/ra_hir_ty/src/traits')
-rw-r--r-- | crates/ra_hir_ty/src/traits/chalk.rs | 10 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/traits/chalk/mapping.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/traits/chalk/tls.rs | 24 |
3 files changed, 20 insertions, 20 deletions
diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs index 1ef5baa05..78d0bc43b 100644 --- a/crates/ra_hir_ty/src/traits/chalk.rs +++ b/crates/ra_hir_ty/src/traits/chalk.rs | |||
@@ -18,7 +18,7 @@ use crate::{ | |||
18 | display::HirDisplay, | 18 | display::HirDisplay, |
19 | method_resolution::{TyFingerprint, ALL_FLOAT_FPS, ALL_INT_FPS}, | 19 | method_resolution::{TyFingerprint, ALL_FLOAT_FPS, ALL_INT_FPS}, |
20 | utils::generics, | 20 | utils::generics, |
21 | CallableDef, DebruijnIndex, FnSig, GenericPredicate, Substs, Ty, TypeCtor, | 21 | CallableDefId, DebruijnIndex, FnSig, GenericPredicate, Substs, Ty, TypeCtor, |
22 | }; | 22 | }; |
23 | use mapping::{ | 23 | use mapping::{ |
24 | convert_where_clauses, generic_predicate_to_inline_bound, make_binders, TypeAliasAsValue, | 24 | convert_where_clauses, generic_predicate_to_inline_bound, make_binders, TypeAliasAsValue, |
@@ -525,7 +525,7 @@ pub(crate) fn fn_def_datum_query( | |||
525 | _krate: CrateId, | 525 | _krate: CrateId, |
526 | fn_def_id: FnDefId, | 526 | fn_def_id: FnDefId, |
527 | ) -> Arc<FnDefDatum> { | 527 | ) -> Arc<FnDefDatum> { |
528 | let callable_def: CallableDef = from_chalk(db, fn_def_id); | 528 | let callable_def: CallableDefId = from_chalk(db, fn_def_id); |
529 | let generic_params = generics(db.upcast(), callable_def.into()); | 529 | let generic_params = generics(db.upcast(), callable_def.into()); |
530 | let sig = db.callable_item_signature(callable_def); | 530 | let sig = db.callable_item_signature(callable_def); |
531 | let bound_vars = Substs::bound_vars(&generic_params, DebruijnIndex::INNERMOST); | 531 | let bound_vars = Substs::bound_vars(&generic_params, DebruijnIndex::INNERMOST); |
@@ -552,14 +552,14 @@ pub(crate) fn fn_def_datum_query( | |||
552 | Arc::new(datum) | 552 | Arc::new(datum) |
553 | } | 553 | } |
554 | 554 | ||
555 | impl From<FnDefId> for crate::CallableDefId { | 555 | impl From<FnDefId> for crate::db::InternedCallableDefId { |
556 | fn from(fn_def_id: FnDefId) -> Self { | 556 | fn from(fn_def_id: FnDefId) -> Self { |
557 | InternKey::from_intern_id(fn_def_id.0) | 557 | InternKey::from_intern_id(fn_def_id.0) |
558 | } | 558 | } |
559 | } | 559 | } |
560 | 560 | ||
561 | impl From<crate::CallableDefId> for FnDefId { | 561 | impl From<crate::db::InternedCallableDefId> for FnDefId { |
562 | fn from(callable_def_id: crate::CallableDefId) -> Self { | 562 | fn from(callable_def_id: crate::db::InternedCallableDefId) -> Self { |
563 | chalk_ir::FnDefId(callable_def_id.as_intern_id()) | 563 | chalk_ir::FnDefId(callable_def_id.as_intern_id()) |
564 | } | 564 | } |
565 | } | 565 | } |
diff --git a/crates/ra_hir_ty/src/traits/chalk/mapping.rs b/crates/ra_hir_ty/src/traits/chalk/mapping.rs index a852ce2ac..09d8347ca 100644 --- a/crates/ra_hir_ty/src/traits/chalk/mapping.rs +++ b/crates/ra_hir_ty/src/traits/chalk/mapping.rs | |||
@@ -16,7 +16,7 @@ use crate::{ | |||
16 | db::HirDatabase, | 16 | db::HirDatabase, |
17 | primitive::{FloatBitness, FloatTy, IntBitness, IntTy, Signedness}, | 17 | primitive::{FloatBitness, FloatTy, IntBitness, IntTy, Signedness}, |
18 | traits::{Canonical, Obligation}, | 18 | traits::{Canonical, Obligation}, |
19 | ApplicationTy, CallableDef, GenericPredicate, InEnvironment, OpaqueTy, OpaqueTyId, | 19 | ApplicationTy, CallableDefId, GenericPredicate, InEnvironment, OpaqueTy, OpaqueTyId, |
20 | ProjectionPredicate, ProjectionTy, Substs, TraitEnvironment, TraitRef, Ty, TyKind, TypeCtor, | 20 | ProjectionPredicate, ProjectionTy, Substs, TraitEnvironment, TraitRef, Ty, TyKind, TypeCtor, |
21 | }; | 21 | }; |
22 | 22 | ||
@@ -454,14 +454,14 @@ impl ToChalk for hir_def::ImplId { | |||
454 | } | 454 | } |
455 | } | 455 | } |
456 | 456 | ||
457 | impl ToChalk for CallableDef { | 457 | impl ToChalk for CallableDefId { |
458 | type Chalk = FnDefId; | 458 | type Chalk = FnDefId; |
459 | 459 | ||
460 | fn to_chalk(self, db: &dyn HirDatabase) -> FnDefId { | 460 | fn to_chalk(self, db: &dyn HirDatabase) -> FnDefId { |
461 | db.intern_callable_def(self).into() | 461 | db.intern_callable_def(self).into() |
462 | } | 462 | } |
463 | 463 | ||
464 | fn from_chalk(db: &dyn HirDatabase, fn_def_id: FnDefId) -> CallableDef { | 464 | fn from_chalk(db: &dyn HirDatabase, fn_def_id: FnDefId) -> CallableDefId { |
465 | db.lookup_intern_callable_def(fn_def_id.into()) | 465 | db.lookup_intern_callable_def(fn_def_id.into()) |
466 | } | 466 | } |
467 | } | 467 | } |
diff --git a/crates/ra_hir_ty/src/traits/chalk/tls.rs b/crates/ra_hir_ty/src/traits/chalk/tls.rs index 1e226baea..db915625c 100644 --- a/crates/ra_hir_ty/src/traits/chalk/tls.rs +++ b/crates/ra_hir_ty/src/traits/chalk/tls.rs | |||
@@ -5,7 +5,7 @@ use chalk_ir::{AliasTy, GenericArg, Goal, Goals, Lifetime, ProgramClauseImplicat | |||
5 | use itertools::Itertools; | 5 | use itertools::Itertools; |
6 | 6 | ||
7 | use super::{from_chalk, Interner}; | 7 | use super::{from_chalk, Interner}; |
8 | use crate::{db::HirDatabase, CallableDef, TypeCtor}; | 8 | use crate::{db::HirDatabase, CallableDefId, TypeCtor}; |
9 | use hir_def::{AdtId, AssocContainerId, DefWithBodyId, Lookup, TypeAliasId}; | 9 | use hir_def::{AdtId, AssocContainerId, DefWithBodyId, Lookup, TypeAliasId}; |
10 | 10 | ||
11 | pub use unsafe_tls::{set_current_program, with_current_program}; | 11 | pub use unsafe_tls::{set_current_program, with_current_program}; |
@@ -38,16 +38,16 @@ impl DebugContext<'_> { | |||
38 | } | 38 | } |
39 | TypeCtor::FnDef(def) => { | 39 | TypeCtor::FnDef(def) => { |
40 | let name = match def { | 40 | let name = match def { |
41 | CallableDef::FunctionId(ff) => self.0.function_data(ff).name.clone(), | 41 | CallableDefId::FunctionId(ff) => self.0.function_data(ff).name.clone(), |
42 | CallableDef::StructId(s) => self.0.struct_data(s).name.clone(), | 42 | CallableDefId::StructId(s) => self.0.struct_data(s).name.clone(), |
43 | CallableDef::EnumVariantId(e) => { | 43 | CallableDefId::EnumVariantId(e) => { |
44 | let enum_data = self.0.enum_data(e.parent); | 44 | let enum_data = self.0.enum_data(e.parent); |
45 | enum_data.variants[e.local_id].name.clone() | 45 | enum_data.variants[e.local_id].name.clone() |
46 | } | 46 | } |
47 | }; | 47 | }; |
48 | match def { | 48 | match def { |
49 | CallableDef::FunctionId(_) => write!(f, "{{fn {}}}", name)?, | 49 | CallableDefId::FunctionId(_) => write!(f, "{{fn {}}}", name)?, |
50 | CallableDef::StructId(_) | CallableDef::EnumVariantId(_) => { | 50 | CallableDefId::StructId(_) | CallableDefId::EnumVariantId(_) => { |
51 | write!(f, "{{ctor {}}}", name)? | 51 | write!(f, "{{ctor {}}}", name)? |
52 | } | 52 | } |
53 | } | 53 | } |
@@ -255,18 +255,18 @@ impl DebugContext<'_> { | |||
255 | fn_def_id: chalk_ir::FnDefId<Interner>, | 255 | fn_def_id: chalk_ir::FnDefId<Interner>, |
256 | fmt: &mut fmt::Formatter<'_>, | 256 | fmt: &mut fmt::Formatter<'_>, |
257 | ) -> Result<(), fmt::Error> { | 257 | ) -> Result<(), fmt::Error> { |
258 | let def: CallableDef = from_chalk(self.0, fn_def_id); | 258 | let def: CallableDefId = from_chalk(self.0, fn_def_id); |
259 | let name = match def { | 259 | let name = match def { |
260 | CallableDef::FunctionId(ff) => self.0.function_data(ff).name.clone(), | 260 | CallableDefId::FunctionId(ff) => self.0.function_data(ff).name.clone(), |
261 | CallableDef::StructId(s) => self.0.struct_data(s).name.clone(), | 261 | CallableDefId::StructId(s) => self.0.struct_data(s).name.clone(), |
262 | CallableDef::EnumVariantId(e) => { | 262 | CallableDefId::EnumVariantId(e) => { |
263 | let enum_data = self.0.enum_data(e.parent); | 263 | let enum_data = self.0.enum_data(e.parent); |
264 | enum_data.variants[e.local_id].name.clone() | 264 | enum_data.variants[e.local_id].name.clone() |
265 | } | 265 | } |
266 | }; | 266 | }; |
267 | match def { | 267 | match def { |
268 | CallableDef::FunctionId(_) => write!(fmt, "{{fn {}}}", name), | 268 | CallableDefId::FunctionId(_) => write!(fmt, "{{fn {}}}", name), |
269 | CallableDef::StructId(_) | CallableDef::EnumVariantId(_) => { | 269 | CallableDefId::StructId(_) | CallableDefId::EnumVariantId(_) => { |
270 | write!(fmt, "{{ctor {}}}", name) | 270 | write!(fmt, "{{ctor {}}}", name) |
271 | } | 271 | } |
272 | } | 272 | } |