mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
fix ADT hover considering only type or const len not lifetimes
This commit is contained in:
parent
899db83128
commit
34a8cd6a7a
2 changed files with 24 additions and 1 deletions
|
@ -1418,7 +1418,8 @@ impl Adt {
|
|||
}
|
||||
|
||||
pub fn layout(self, db: &dyn HirDatabase) -> Result<Layout, LayoutError> {
|
||||
if db.generic_params(self.into()).iter().count() != 0 {
|
||||
let generic_params = &db.generic_params(self.into());
|
||||
if generic_params.iter().next().is_some() || generic_params.iter_lt().next().is_some() {
|
||||
return Err(LayoutError::HasPlaceholder);
|
||||
}
|
||||
let krate = self.krate(db).id;
|
||||
|
|
|
@ -7856,3 +7856,25 @@ impl Iterator for S {
|
|||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hover_lifetime_regression_16963() {
|
||||
check(
|
||||
r#"
|
||||
struct Pedro$0<'a> {
|
||||
hola: &'a str
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
*Pedro*
|
||||
|
||||
```rust
|
||||
test
|
||||
```
|
||||
|
||||
```rust
|
||||
struct Pedro<'a>
|
||||
```
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue