From b7f572b6257810c683a570095c3971d78506a655 Mon Sep 17 00:00:00 2001 From: Albin Hedman Date: Sun, 4 Jul 2021 19:11:54 +0200 Subject: [PATCH] Add test for try operator with Option --- src/test/ui/consts/try-operator.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/test/ui/consts/try-operator.rs b/src/test/ui/consts/try-operator.rs index ff0f407c53ee7..163d44f724655 100644 --- a/src/test/ui/consts/try-operator.rs +++ b/src/test/ui/consts/try-operator.rs @@ -6,11 +6,18 @@ #![feature(const_identity_convert)] fn main() { - const fn foo() -> Result { + const fn result() -> Result { Err(())?; Ok(true) } - const FOO: Result = foo(); + const FOO: Result = result(); assert_eq!(Err(()), FOO); + + const fn option() -> Option<()> { + None?; + Some(()) + } + const BAR: Option<()> = option(); + assert_eq!(None, BAR); }