aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_hir/src/ty/lower.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs
index b4496789b..8a8cc2a24 100644
--- a/crates/ra_hir/src/ty/lower.rs
+++ b/crates/ra_hir/src/ty/lower.rs
@@ -206,23 +206,20 @@ pub(super) fn substs_from_path_segment(
206 substs.push(Ty::Unknown); 206 substs.push(Ty::Unknown);
207 } 207 }
208 assert_eq!(substs.len(), def_generics.count_params_including_parent()); 208 assert_eq!(substs.len(), def_generics.count_params_including_parent());
209 let mut substs = Substs(substs.into());
210 209
211 // handle defaults 210 // handle defaults
212 if let Some(def_generic) = def_generic { 211 if let Some(def_generic) = def_generic {
213 let default_substs = db.generic_defaults(def_generic); 212 let default_substs = db.generic_defaults(def_generic);
214 assert_eq!(substs.len(), default_substs.len()); 213 assert_eq!(substs.len(), default_substs.len());
215 214
216 let mut i = 0; 215 for (i, default_ty) in default_substs.iter().enumerate() {
217 substs.walk_mut(&mut |ty| { 216 if substs[i] == Ty::Unknown {
218 if *ty == Ty::Unknown { 217 substs[i] = default_ty.clone();
219 *ty = default_substs[i].clone();
220 } 218 }
221 i += 1; 219 }
222 });
223 } 220 }
224 221
225 substs 222 Substs(substs.into())
226} 223}
227 224
228impl TraitRef { 225impl TraitRef {