aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/lib.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2020-04-17 21:48:29 +0100
committerFlorian Diebold <[email protected]>2020-04-17 23:01:09 +0100
commitd3cb9ea0bfb6c9e6c8b57a46feb1de696084d994 (patch)
treedec68fc67c90737820b81da02f4f03028d12b43d /crates/ra_hir_ty/src/lib.rs
parenta4cda3efbbabe4c6129de4dc095953fe858d7d3f (diff)
Fix another crash from wrong binders
Basically, if we had something like `dyn Trait<T>` (where `T` is a type parameter) in an impl we lowered that to `dyn Trait<^0.0>`, when it should be `dyn Trait<^1.0>` because the `dyn` introduces a new binder. With one type parameter, that's just wrong, with two, it'll lead to crashes.
Diffstat (limited to 'crates/ra_hir_ty/src/lib.rs')
-rw-r--r--crates/ra_hir_ty/src/lib.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_hir_ty/src/lib.rs b/crates/ra_hir_ty/src/lib.rs
index 2677f3af2..a4b8d6683 100644
--- a/crates/ra_hir_ty/src/lib.rs
+++ b/crates/ra_hir_ty/src/lib.rs
@@ -396,12 +396,12 @@ impl Substs {
396 } 396 }
397 397
398 /// Return Substs that replace each parameter by a bound variable. 398 /// Return Substs that replace each parameter by a bound variable.
399 pub(crate) fn bound_vars(generic_params: &Generics) -> Substs { 399 pub(crate) fn bound_vars(generic_params: &Generics, debruijn: DebruijnIndex) -> Substs {
400 Substs( 400 Substs(
401 generic_params 401 generic_params
402 .iter() 402 .iter()
403 .enumerate() 403 .enumerate()
404 .map(|(idx, _)| Ty::Bound(BoundVar::new(DebruijnIndex::INNERMOST, idx))) 404 .map(|(idx, _)| Ty::Bound(BoundVar::new(debruijn, idx)))
405 .collect(), 405 .collect(),
406 ) 406 )
407 } 407 }