mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
⬆️ rust-analyzer
This commit is contained in:
parent
8536eb016c
commit
a99a48e786
86 changed files with 3149 additions and 1653 deletions
|
@ -48,10 +48,14 @@ pub(crate) fn goto_definition(
|
|||
_ => 1,
|
||||
})?;
|
||||
if let Some(doc_comment) = token_as_doc_comment(&original_token) {
|
||||
return doc_comment.get_definition_with_descend_at(sema, position.offset, |def, _, _| {
|
||||
let nav = def.try_to_nav(db)?;
|
||||
Some(RangeInfo::new(original_token.text_range(), vec![nav]))
|
||||
});
|
||||
return doc_comment.get_definition_with_descend_at(
|
||||
sema,
|
||||
position.offset,
|
||||
|def, _, link_range| {
|
||||
let nav = def.try_to_nav(db)?;
|
||||
Some(RangeInfo::new(link_range, vec![nav]))
|
||||
},
|
||||
);
|
||||
}
|
||||
let navs = sema
|
||||
.descend_into_macros(original_token.clone())
|
||||
|
|
|
@ -4913,6 +4913,22 @@ fn foo() -> NotResult<(), Short> {
|
|||
```
|
||||
"#]],
|
||||
);
|
||||
check_hover_range(
|
||||
r#"
|
||||
//- minicore: try
|
||||
use core::ops::ControlFlow;
|
||||
fn foo() -> ControlFlow<()> {
|
||||
$0ControlFlow::Break(())?$0;
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
```text
|
||||
Try Target Type: ControlFlow<(), {unknown}>
|
||||
Propagated as: ControlFlow<(), ()>
|
||||
```
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -4928,9 +4944,9 @@ fn foo() -> Option<()> {
|
|||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
```rust
|
||||
<Option<i32> as Try>::Output
|
||||
```"#]],
|
||||
```rust
|
||||
i32
|
||||
```"#]],
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue