diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-04-05 20:59:25 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-04-05 20:59:25 +0100 |
commit | f25c1e7c6a119a1035ba226f0735a0d6667a5db8 (patch) | |
tree | 0f666c5b917de8a0f2ebf5fba185500d153036f3 /crates/hir_ty/src/traits | |
parent | 8c96a7d81e29061537d78b5670a3474cb136422d (diff) | |
parent | b67148daea86d85d211c4243f22635d6ac7e1983 (diff) |
Merge #8356
8356: Align more methods to Chalk r=flodiebold a=flodiebold
Related to #8313.
Move some inherent methods that don't exist in Chalk to an extension trait, remove some others.
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/traits')
-rw-r--r-- | crates/hir_ty/src/traits/chalk.rs | 14 | ||||
-rw-r--r-- | crates/hir_ty/src/traits/chalk/mapping.rs | 6 |
2 files changed, 9 insertions, 11 deletions
diff --git a/crates/hir_ty/src/traits/chalk.rs b/crates/hir_ty/src/traits/chalk.rs index dff87ef70..5a8b5cd86 100644 --- a/crates/hir_ty/src/traits/chalk.rs +++ b/crates/hir_ty/src/traits/chalk.rs | |||
@@ -220,7 +220,8 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> { | |||
220 | let impl_bound = WhereClause::Implemented(TraitRef { | 220 | let impl_bound = WhereClause::Implemented(TraitRef { |
221 | trait_id: to_chalk_trait_id(future_trait), | 221 | trait_id: to_chalk_trait_id(future_trait), |
222 | // Self type as the first parameter. | 222 | // Self type as the first parameter. |
223 | substitution: Substitution::single( | 223 | substitution: Substitution::from1( |
224 | &Interner, | ||
224 | TyKind::BoundVar(BoundVar { | 225 | TyKind::BoundVar(BoundVar { |
225 | debruijn: DebruijnIndex::INNERMOST, | 226 | debruijn: DebruijnIndex::INNERMOST, |
226 | index: 0, | 227 | index: 0, |
@@ -232,7 +233,8 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> { | |||
232 | alias: AliasTy::Projection(ProjectionTy { | 233 | alias: AliasTy::Projection(ProjectionTy { |
233 | associated_ty_id: to_assoc_type_id(future_output), | 234 | associated_ty_id: to_assoc_type_id(future_output), |
234 | // Self type as the first parameter. | 235 | // Self type as the first parameter. |
235 | substitution: Substitution::single( | 236 | substitution: Substitution::from1( |
237 | &Interner, | ||
236 | TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, 0)) | 238 | TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, 0)) |
237 | .intern(&Interner), | 239 | .intern(&Interner), |
238 | ), | 240 | ), |
@@ -244,8 +246,8 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> { | |||
244 | let bound = OpaqueTyDatumBound { | 246 | let bound = OpaqueTyDatumBound { |
245 | bounds: make_binders( | 247 | bounds: make_binders( |
246 | vec![ | 248 | vec![ |
247 | wrap_in_empty_binders(impl_bound).to_chalk(self.db), | 249 | crate::wrap_empty_binders(impl_bound).to_chalk(self.db), |
248 | wrap_in_empty_binders(proj_bound).to_chalk(self.db), | 250 | crate::wrap_empty_binders(proj_bound).to_chalk(self.db), |
249 | ], | 251 | ], |
250 | 1, | 252 | 1, |
251 | ), | 253 | ), |
@@ -721,7 +723,3 @@ impl From<crate::db::InternedClosureId> for chalk_ir::ClosureId<Interner> { | |||
721 | chalk_ir::ClosureId(id.as_intern_id()) | 723 | chalk_ir::ClosureId(id.as_intern_id()) |
722 | } | 724 | } |
723 | } | 725 | } |
724 | |||
725 | fn wrap_in_empty_binders<T: crate::TypeWalk>(value: T) -> crate::Binders<T> { | ||
726 | crate::Binders::wrap_empty(value) | ||
727 | } | ||
diff --git a/crates/hir_ty/src/traits/chalk/mapping.rs b/crates/hir_ty/src/traits/chalk/mapping.rs index c3b148cab..9f10b889f 100644 --- a/crates/hir_ty/src/traits/chalk/mapping.rs +++ b/crates/hir_ty/src/traits/chalk/mapping.rs | |||
@@ -10,9 +10,9 @@ use base_db::salsa::InternKey; | |||
10 | use hir_def::{GenericDefId, TypeAliasId}; | 10 | use hir_def::{GenericDefId, TypeAliasId}; |
11 | 11 | ||
12 | use crate::{ | 12 | use crate::{ |
13 | db::HirDatabase, primitive::UintTy, AliasTy, CallableDefId, Canonical, DomainGoal, FnPointer, | 13 | chalk_ext::ProjectionTyExt, db::HirDatabase, primitive::UintTy, AliasTy, CallableDefId, |
14 | GenericArg, InEnvironment, OpaqueTy, ProjectionTy, QuantifiedWhereClause, Scalar, Substitution, | 14 | Canonical, DomainGoal, FnPointer, GenericArg, InEnvironment, OpaqueTy, ProjectionTy, |
15 | TraitRef, Ty, TypeWalk, WhereClause, | 15 | QuantifiedWhereClause, Scalar, Substitution, TraitRef, Ty, TypeWalk, WhereClause, |
16 | }; | 16 | }; |
17 | 17 | ||
18 | use super::interner::*; | 18 | use super::interner::*; |