diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-14 15:34:37 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-14 15:34:37 +0000 |
commit | 406e4be04c2e74d58bcaa7e823e2509d1a7803d4 (patch) | |
tree | 79dcaa50fe38214d03c4e60b3738ca578e09d659 /crates/hir_ty/src/lower.rs | |
parent | f57e2f55984758a83644b852a4cc47e0b27945df (diff) | |
parent | 195414783402d6973f4e673e84be9b7bc19cbfa6 (diff) |
Merge #8016
8016: More Chalk adaptations r=flodiebold a=flodiebold
- rename a bunch of fields
- use `chalk_ir::FnSig`
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/lower.rs')
-rw-r--r-- | crates/hir_ty/src/lower.rs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs index c32dca9d7..d026310f4 100644 --- a/crates/hir_ty/src/lower.rs +++ b/crates/hir_ty/src/lower.rs | |||
@@ -8,7 +8,7 @@ | |||
8 | use std::{iter, sync::Arc}; | 8 | use std::{iter, sync::Arc}; |
9 | 9 | ||
10 | use base_db::CrateId; | 10 | use base_db::CrateId; |
11 | use chalk_ir::{cast::Cast, Mutability}; | 11 | use chalk_ir::{cast::Cast, Mutability, Safety}; |
12 | use hir_def::{ | 12 | use hir_def::{ |
13 | adt::StructKind, | 13 | adt::StructKind, |
14 | builtin_type::BuiltinType, | 14 | builtin_type::BuiltinType, |
@@ -181,7 +181,7 @@ impl<'a> TyLoweringContext<'a> { | |||
181 | let substs = Substs(params.iter().map(|tr| self.lower_ty(tr)).collect()); | 181 | let substs = Substs(params.iter().map(|tr| self.lower_ty(tr)).collect()); |
182 | TyKind::Function(FnPointer { | 182 | TyKind::Function(FnPointer { |
183 | num_args: substs.len() - 1, | 183 | num_args: substs.len() - 1, |
184 | sig: FnSig { variadic: *is_varargs }, | 184 | sig: FnSig { abi: (), safety: Safety::Safe, variadic: *is_varargs }, |
185 | substs, | 185 | substs, |
186 | }) | 186 | }) |
187 | .intern(&Interner) | 187 | .intern(&Interner) |
@@ -230,8 +230,11 @@ impl<'a> TyLoweringContext<'a> { | |||
230 | let opaque_ty_id = self.db.intern_impl_trait_id(impl_trait_id).into(); | 230 | let opaque_ty_id = self.db.intern_impl_trait_id(impl_trait_id).into(); |
231 | let generics = generics(self.db.upcast(), func.into()); | 231 | let generics = generics(self.db.upcast(), func.into()); |
232 | let parameters = Substs::bound_vars(&generics, self.in_binders); | 232 | let parameters = Substs::bound_vars(&generics, self.in_binders); |
233 | TyKind::Alias(AliasTy::Opaque(OpaqueTy { opaque_ty_id, parameters })) | 233 | TyKind::Alias(AliasTy::Opaque(OpaqueTy { |
234 | .intern(&Interner) | 234 | opaque_ty_id, |
235 | substitution: parameters, | ||
236 | })) | ||
237 | .intern(&Interner) | ||
235 | } | 238 | } |
236 | ImplTraitLoweringMode::Param => { | 239 | ImplTraitLoweringMode::Param => { |
237 | let idx = self.impl_trait_counter.get(); | 240 | let idx = self.impl_trait_counter.get(); |
@@ -357,8 +360,8 @@ impl<'a> TyLoweringContext<'a> { | |||
357 | Some((super_trait_ref, associated_ty)) => { | 360 | Some((super_trait_ref, associated_ty)) => { |
358 | // FIXME handle type parameters on the segment | 361 | // FIXME handle type parameters on the segment |
359 | TyKind::Alias(AliasTy::Projection(ProjectionTy { | 362 | TyKind::Alias(AliasTy::Projection(ProjectionTy { |
360 | associated_ty: to_assoc_type_id(associated_ty), | 363 | associated_ty_id: to_assoc_type_id(associated_ty), |
361 | parameters: super_trait_ref.substs, | 364 | substitution: super_trait_ref.substs, |
362 | })) | 365 | })) |
363 | .intern(&Interner) | 366 | .intern(&Interner) |
364 | } | 367 | } |
@@ -478,8 +481,8 @@ impl<'a> TyLoweringContext<'a> { | |||
478 | // FIXME handle type parameters on the segment | 481 | // FIXME handle type parameters on the segment |
479 | return Some( | 482 | return Some( |
480 | TyKind::Alias(AliasTy::Projection(ProjectionTy { | 483 | TyKind::Alias(AliasTy::Projection(ProjectionTy { |
481 | associated_ty: to_assoc_type_id(associated_ty), | 484 | associated_ty_id: to_assoc_type_id(associated_ty), |
482 | parameters: substs, | 485 | substitution: substs, |
483 | })) | 486 | })) |
484 | .intern(&Interner), | 487 | .intern(&Interner), |
485 | ); | 488 | ); |
@@ -736,8 +739,8 @@ impl<'a> TyLoweringContext<'a> { | |||
736 | Some(t) => t, | 739 | Some(t) => t, |
737 | }; | 740 | }; |
738 | let projection_ty = ProjectionTy { | 741 | let projection_ty = ProjectionTy { |
739 | associated_ty: to_assoc_type_id(associated_ty), | 742 | associated_ty_id: to_assoc_type_id(associated_ty), |
740 | parameters: super_trait_ref.substs, | 743 | substitution: super_trait_ref.substs, |
741 | }; | 744 | }; |
742 | let mut preds = SmallVec::with_capacity( | 745 | let mut preds = SmallVec::with_capacity( |
743 | binding.type_ref.as_ref().map_or(0, |_| 1) + binding.bounds.len(), | 746 | binding.type_ref.as_ref().map_or(0, |_| 1) + binding.bounds.len(), |