mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Diagnose incorrect usages of the question mark operator
This commit is contained in:
parent
8406380b5a
commit
381366f1dd
13 changed files with 289 additions and 125 deletions
|
@ -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