]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/question_mark.fixed
Auto merge of #8374 - Alexendoo:bless-revisions, r=camsteffen
[rust.git] / tests / ui / question_mark.fixed
index e93469e5f556bd55737c0628961e540e7caf5be1..13ce0f32d4bb14b7e6f2777be15ee32fc6e7e52b 100644 (file)
@@ -136,6 +136,24 @@ fn result_func(x: Result<i32, i32>) -> Result<i32, i32> {
     Ok(y)
 }
 
+// see issue #8019
+pub enum NotOption {
+    None,
+    First,
+    AfterFirst,
+}
+
+fn obj(_: i32) -> Result<(), NotOption> {
+    Err(NotOption::First)
+}
+
+fn f() -> NotOption {
+    if obj(2).is_err() {
+        return NotOption::None;
+    }
+    NotOption::First
+}
+
 fn main() {
     some_func(Some(42));
     some_func(None);
@@ -157,4 +175,5 @@ fn main() {
     func();
 
     let _ = result_func(Ok(42));
+    let _ = f();
 }