display correctly 'impl Trait<T> + Trait<T>' #4814

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
This commit is contained in:
Benjamin Coenen 2020-08-13 22:13:34 +02:00
parent 3d6fd620e8
commit 947a27b797
2 changed files with 20 additions and 0 deletions

View File

@ -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, " + ")?;

View File

@ -766,6 +766,25 @@ fn main() {
)
}
#[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<Target=u8> + DerefMut<Target=u8>) {}"#,
expect![[r#"
*_x*
```rust
impl Deref<Target = u8> + DerefMut<Target = u8>
```
"#]],
)
}
#[test]
fn test_hover_infer_associated_method_result() {
check(