mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-27 18:26:19 +00:00
Don't show dyn hint in a HRTB bound
This commit is contained in:
parent
3816d0ae53
commit
3931afa624
1 changed files with 17 additions and 2 deletions
|
|
@ -17,8 +17,12 @@ pub(super) fn hints(
|
|||
let parent = path.syntax().parent()?;
|
||||
let range = match path {
|
||||
Either::Left(path) => {
|
||||
let paren =
|
||||
parent.ancestors().take_while(|it| ast::ParenType::can_cast(it.kind())).last();
|
||||
let paren = parent
|
||||
.ancestors()
|
||||
.take_while(|it| {
|
||||
ast::ParenType::can_cast(it.kind()) || ast::ForType::can_cast(it.kind())
|
||||
})
|
||||
.last();
|
||||
let parent = paren.as_ref().and_then(|it| it.parent()).unwrap_or(parent);
|
||||
if ast::TypeBound::can_cast(parent.kind())
|
||||
|| ast::TypeAnchor::can_cast(parent.kind())
|
||||
|
|
@ -136,4 +140,15 @@ fn foo(
|
|||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hrtb_bound_does_not_add_dyn() {
|
||||
check(
|
||||
r#"
|
||||
//- minicore: fn
|
||||
fn test<F>(f: F) where F: for<'a> FnOnce(&'a i32) {}
|
||||
// ^: Sized
|
||||
"#,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue