diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-10-30 10:14:18 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-10-30 10:14:18 +0000 |
commit | f996b6019bd2f388bd9994ea83f25487eb111560 (patch) | |
tree | 4662b1c76bed5e830c1dae9ee5dbf47520f41e1e /crates/ra_hir/src/ty/traits | |
parent | 8046f5b24a316a50e109fe484cde4c128293fa97 (diff) | |
parent | c9cd6aa370667783292de3bc580e0503a409e453 (diff) |
Merge #2126
2126: Move ids to hir_def crate r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/ty/traits')
-rw-r--r-- | crates/ra_hir/src/ty/traits/chalk.rs | 38 |
1 files changed, 7 insertions, 31 deletions
diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs index e18c28cf6..ab66515be 100644 --- a/crates/ra_hir/src/ty/traits/chalk.rs +++ b/crates/ra_hir/src/ty/traits/chalk.rs | |||
@@ -162,11 +162,11 @@ impl ToChalk for Trait { | |||
162 | type Chalk = chalk_ir::TraitId; | 162 | type Chalk = chalk_ir::TraitId; |
163 | 163 | ||
164 | fn to_chalk(self, _db: &impl HirDatabase) -> chalk_ir::TraitId { | 164 | fn to_chalk(self, _db: &impl HirDatabase) -> chalk_ir::TraitId { |
165 | self.id.into() | 165 | chalk_ir::TraitId(id_to_chalk(self.id)) |
166 | } | 166 | } |
167 | 167 | ||
168 | fn from_chalk(_db: &impl HirDatabase, trait_id: chalk_ir::TraitId) -> Trait { | 168 | fn from_chalk(_db: &impl HirDatabase, trait_id: chalk_ir::TraitId) -> Trait { |
169 | Trait { id: trait_id.into() } | 169 | Trait { id: id_from_chalk(trait_id.0) } |
170 | } | 170 | } |
171 | } | 171 | } |
172 | 172 | ||
@@ -198,11 +198,11 @@ impl ToChalk for TypeAlias { | |||
198 | type Chalk = chalk_ir::TypeId; | 198 | type Chalk = chalk_ir::TypeId; |
199 | 199 | ||
200 | fn to_chalk(self, _db: &impl HirDatabase) -> chalk_ir::TypeId { | 200 | fn to_chalk(self, _db: &impl HirDatabase) -> chalk_ir::TypeId { |
201 | self.id.into() | 201 | chalk_ir::TypeId(id_to_chalk(self.id)) |
202 | } | 202 | } |
203 | 203 | ||
204 | fn from_chalk(_db: &impl HirDatabase, impl_id: chalk_ir::TypeId) -> TypeAlias { | 204 | fn from_chalk(_db: &impl HirDatabase, type_alias_id: chalk_ir::TypeId) -> TypeAlias { |
205 | TypeAlias { id: impl_id.into() } | 205 | TypeAlias { id: id_from_chalk(type_alias_id.0) } |
206 | } | 206 | } |
207 | } | 207 | } |
208 | 208 | ||
@@ -537,7 +537,7 @@ pub(crate) fn trait_datum_query( | |||
537 | let trait_ref = trait_.trait_ref(db).subst(&bound_vars).to_chalk(db); | 537 | let trait_ref = trait_.trait_ref(db).subst(&bound_vars).to_chalk(db); |
538 | let flags = chalk_rust_ir::TraitFlags { | 538 | let flags = chalk_rust_ir::TraitFlags { |
539 | auto: trait_.is_auto(db), | 539 | auto: trait_.is_auto(db), |
540 | upstream: trait_.module(db).krate(db) != Some(krate), | 540 | upstream: trait_.module(db).krate() != krate, |
541 | non_enumerable: true, | 541 | non_enumerable: true, |
542 | // FIXME set these flags correctly | 542 | // FIXME set these flags correctly |
543 | marker: false, | 543 | marker: false, |
@@ -625,7 +625,7 @@ fn impl_block_datum( | |||
625 | .target_trait_ref(db) | 625 | .target_trait_ref(db) |
626 | .expect("FIXME handle unresolved impl block trait ref") | 626 | .expect("FIXME handle unresolved impl block trait ref") |
627 | .subst(&bound_vars); | 627 | .subst(&bound_vars); |
628 | let impl_type = if impl_block.module().krate(db) == Some(krate) { | 628 | let impl_type = if impl_block.module().krate() == krate { |
629 | chalk_rust_ir::ImplType::Local | 629 | chalk_rust_ir::ImplType::Local |
630 | } else { | 630 | } else { |
631 | chalk_rust_ir::ImplType::External | 631 | chalk_rust_ir::ImplType::External |
@@ -775,30 +775,6 @@ fn id_to_chalk<T: InternKey>(salsa_id: T) -> chalk_ir::RawId { | |||
775 | chalk_ir::RawId { index: salsa_id.as_intern_id().as_u32() } | 775 | chalk_ir::RawId { index: salsa_id.as_intern_id().as_u32() } |
776 | } | 776 | } |
777 | 777 | ||
778 | impl From<chalk_ir::TraitId> for crate::ids::TraitId { | ||
779 | fn from(trait_id: chalk_ir::TraitId) -> Self { | ||
780 | id_from_chalk(trait_id.0) | ||
781 | } | ||
782 | } | ||
783 | |||
784 | impl From<crate::ids::TraitId> for chalk_ir::TraitId { | ||
785 | fn from(trait_id: crate::ids::TraitId) -> Self { | ||
786 | chalk_ir::TraitId(id_to_chalk(trait_id)) | ||
787 | } | ||
788 | } | ||
789 | |||
790 | impl From<chalk_ir::TypeId> for crate::ids::TypeAliasId { | ||
791 | fn from(type_id: chalk_ir::TypeId) -> Self { | ||
792 | id_from_chalk(type_id.0) | ||
793 | } | ||
794 | } | ||
795 | |||
796 | impl From<crate::ids::TypeAliasId> for chalk_ir::TypeId { | ||
797 | fn from(type_id: crate::ids::TypeAliasId) -> Self { | ||
798 | chalk_ir::TypeId(id_to_chalk(type_id)) | ||
799 | } | ||
800 | } | ||
801 | |||
802 | impl From<chalk_ir::StructId> for crate::ids::TypeCtorId { | 778 | impl From<chalk_ir::StructId> for crate::ids::TypeCtorId { |
803 | fn from(struct_id: chalk_ir::StructId) -> Self { | 779 | fn from(struct_id: chalk_ir::StructId) -> Self { |
804 | id_from_chalk(struct_id.0) | 780 | id_from_chalk(struct_id.0) |