Diagnose incorrect usages of the question mark operator

This commit is contained in:
Lukas Wirth 2022-10-05 19:15:07 +02:00
parent 8406380b5a
commit 381366f1dd
13 changed files with 289 additions and 125 deletions

View file

@ -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
```"#]],
);
}