aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/lower.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-03-15 18:49:07 +0000
committerGitHub <[email protected]>2021-03-15 18:49:07 +0000
commitc0a2b4e826e1da20d3cfa8c279fcdffa24f32a7d (patch)
tree400efb6e39a557454edd99184c005b413ae25af3 /crates/hir_ty/src/lower.rs
parent47b74cadf9774f624ff13f8c7929c66be8247fc8 (diff)
parent455e755bb011fff6d1389701063956fbf16daaf1 (diff)
Merge #8039
8039: Use SmallVec for Substs r=flodiebold a=flodiebold Doesn't help as much as I hoped, but it helps a bit and I also did some refactorings that were necessary anyway. Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/lower.rs')
-rw-r--r--crates/hir_ty/src/lower.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs
index b4c650fa1..6ab757bfc 100644
--- a/crates/hir_ty/src/lower.rs
+++ b/crates/hir_ty/src/lower.rs
@@ -31,7 +31,7 @@ use crate::{
31 traits::chalk::{Interner, ToChalk}, 31 traits::chalk::{Interner, ToChalk},
32 utils::{ 32 utils::{
33 all_super_trait_refs, associated_type_by_name_including_super_traits, generics, 33 all_super_trait_refs, associated_type_by_name_including_super_traits, generics,
34 make_mut_slice, variant_data, 34 variant_data,
35 }, 35 },
36 AliasTy, Binders, BoundVar, CallableSig, DebruijnIndex, FnPointer, FnSig, GenericPredicate, 36 AliasTy, Binders, BoundVar, CallableSig, DebruijnIndex, FnPointer, FnSig, GenericPredicate,
37 ImplTraitId, OpaqueTy, PolyFnSig, ProjectionPredicate, ProjectionTy, ReturnTypeImplTrait, 37 ImplTraitId, OpaqueTy, PolyFnSig, ProjectionPredicate, ProjectionTy, ReturnTypeImplTrait,
@@ -150,8 +150,9 @@ impl<'a> TyLoweringContext<'a> {
150 let ty = match type_ref { 150 let ty = match type_ref {
151 TypeRef::Never => TyKind::Never.intern(&Interner), 151 TypeRef::Never => TyKind::Never.intern(&Interner),
152 TypeRef::Tuple(inner) => { 152 TypeRef::Tuple(inner) => {
153 let inner_tys: Arc<[Ty]> = inner.iter().map(|tr| self.lower_ty(tr)).collect(); 153 let inner_tys = inner.iter().map(|tr| self.lower_ty(tr));
154 TyKind::Tuple(inner_tys.len(), Substs(inner_tys)).intern(&Interner) 154 TyKind::Tuple(inner_tys.len(), Substs::from_iter(&Interner, inner_tys))
155 .intern(&Interner)
155 } 156 }
156 TypeRef::Path(path) => { 157 TypeRef::Path(path) => {
157 let (ty, res_) = self.lower_path(path); 158 let (ty, res_) = self.lower_path(path);
@@ -638,7 +639,7 @@ impl<'a> TyLoweringContext<'a> {
638 ) -> TraitRef { 639 ) -> TraitRef {
639 let mut substs = self.trait_ref_substs_from_path(segment, resolved); 640 let mut substs = self.trait_ref_substs_from_path(segment, resolved);
640 if let Some(self_ty) = explicit_self_ty { 641 if let Some(self_ty) = explicit_self_ty {
641 make_mut_slice(&mut substs.0)[0] = self_ty; 642 substs.0[0] = self_ty;
642 } 643 }
643 TraitRef { trait_: resolved, substs } 644 TraitRef { trait_: resolved, substs }
644 } 645 }