diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs index 19770e609af..64b68014d8a 100644 --- a/crates/hir_ty/src/display.rs +++ b/crates/hir_ty/src/display.rs @@ -511,6 +511,7 @@ fn write_bounds_like_dyn_trait( GenericPredicate::Implemented(trait_ref) => { if angle_open { write!(f, ">")?; + angle_open = false; } if !first { write!(f, " + ")?; diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 331aa4db0c7..300c00edc82 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs @@ -766,6 +766,25 @@ fn hover_for_param_edge() { ) } + #[test] + fn hover_for_param_with_multiple_traits() { + check( + r#"trait Deref { + type Target: ?Sized; + } + trait DerefMut { + type Target: ?Sized; + } + fn f(_x<|>: impl Deref + DerefMut) {}"#, + expect![[r#" + *_x* + ```rust + impl Deref + DerefMut + ``` + "#]], + ) + } + #[test] fn test_hover_infer_associated_method_result() { check(