mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Infallible definition hovers
This commit is contained in:
parent
2223b4fa71
commit
a822291a02
5 changed files with 135 additions and 38 deletions
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue