]> git.lizzy.rs Git - rust.git/blobdiff - crates/ide/src/hover/tests.rs
Diagnose incorrect usages of the question mark operator
[rust.git] / crates / ide / src / hover / tests.rs
index eb997e6fef83022f726dec8a2ff0e5cbcd6fdc86..5cab017a58dbdba582340ca11d9c682bfd58294c 100644 (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
+            ```"#]],
     );
 }