Infallible definition hovers

This commit is contained in:
Lukas Wirth 2024-02-19 18:00:50 +01:00
parent 2223b4fa71
commit a822291a02
5 changed files with 135 additions and 38 deletions

View file

@ -1279,11 +1279,11 @@ impl Thing {
);
check(
r#"
enum Thing { A }
impl Thing {
pub fn thing(a: Self$0) {}
}
"#,
enum Thing { A }
impl Thing {
pub fn thing(a: Self$0) {}
}
"#,
expect![[r#"
*Self*
@ -1298,6 +1298,42 @@ impl Thing {
```
"#]],
);
check(
r#"
impl usize {
pub fn thing(a: Self$0) {}
}
"#,
expect![[r#"
*Self*
```rust
test
```
```rust
usize
```
"#]],
);
check(
r#"
impl fn() -> usize {
pub fn thing(a: Self$0) {}
}
"#,
expect![[r#"
*Self*
```rust
test
```
```rust
fn() -> usize
```
"#]],
);
}
#[test]
@ -7201,6 +7237,65 @@ impl Iterator for S {
);
}
#[test]
fn extern_items() {
check(
r#"
extern "C" {
static STATIC$0: ();
}
"#,
expect![[r#"
*STATIC*
```rust
test
```
```rust
static STATIC: ()
```
"#]],
);
check(
r#"
extern "C" {
fn fun$0();
}
"#,
expect![[r#"
*fun*
```rust
test
```
```rust
unsafe fn fun()
```
"#]],
);
check(
r#"
extern "C" {
type Ty$0;
}
"#,
expect![[r#"
*Ty*
```rust
test
```
```rust
// size = 0, align = 1
type Ty
```
"#]],
);
}
#[test]
fn notable_ranged() {
check_hover_range(