diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-05-14 12:20:42 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-05-14 12:20:42 +0100 |
commit | f1587ac26332c3378c41d3cc552b270ee6a45cc4 (patch) | |
tree | a3a0d688da9315f72cad557af7598779e3937f19 /crates/ra_hir_ty/src | |
parent | 5148d6dc66d80b375a98143dfbb556ec675bbffc (diff) | |
parent | ccd526837459724211c8281926aa86522b2506d5 (diff) |
Merge #4445
4445: Correctly fill default type parameters r=flodiebold a=montekki
Fixes #3877
So, basically even if the parameters are omitted from the `impl` block, check the parameters in `trait` if they have a default type, and if they do go from `hir` to `ast::TypeArg`. I've added a helper for that but I am not sure that it's a proper way to go from `hir` to `ast` here.
Co-authored-by: Fedor Sakharov <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty/src')
-rw-r--r-- | crates/ra_hir_ty/src/lib.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/lib.rs b/crates/ra_hir_ty/src/lib.rs index e8f3482fe..ccc4348f4 100644 --- a/crates/ra_hir_ty/src/lib.rs +++ b/crates/ra_hir_ty/src/lib.rs | |||
@@ -427,6 +427,11 @@ impl Substs { | |||
427 | } | 427 | } |
428 | } | 428 | } |
429 | 429 | ||
430 | /// Return an index of a parameter in the generic type parameter list by it's id. | ||
431 | pub fn param_idx(db: &dyn HirDatabase, id: TypeParamId) -> Option<usize> { | ||
432 | generics(db.upcast(), id.parent).param_idx(id) | ||
433 | } | ||
434 | |||
430 | #[derive(Debug, Clone)] | 435 | #[derive(Debug, Clone)] |
431 | pub struct SubstsBuilder { | 436 | pub struct SubstsBuilder { |
432 | vec: Vec<Ty>, | 437 | vec: Vec<Ty>, |